将Github上的代码下载下来时,通常会有一个requirements.txt的文件,利用它可以高效配置代码运行所需环境

进入要安装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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值