进入要安装requirements.txt里面的包的虚拟环境,现在的目录位置是(base) C:\Users\Chao,我的requirements.txt文件在f盘,不能直接运行,需要进入requirements.txt所在的文件夹。
默认路径:默认路径是你的用户名路径.
切换路径:Anaconda Prompt在默认路径下,无法直接cd到其他盘。只能在根目录下进行切换盘符
返回根目录:使用cd …切换到上级目录
切换到requirements.txt目录之后,输入>>pip install -r requirements.txt安装所需的包。
出现错误:
Looking in indexes: http://mirrors.aliyun.com/pypi/simple
WARNING: The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.aliyun.com'.
ERROR: Could not find a version that satisfies the requirement aiofiles==23.2.1 (from versions: none)
WARNING: The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.aliyun.com'.
ERROR: No matching distribution found for aiofiles==23.2.1
解决:
pip install aiofiles==23.2.1 -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn
后续再次执行安装txt又出现类似错误,不如直接:
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/ --
trusted-host pypi.tuna.tsinghua.edu.cn