利用requirements.txt在不同电脑切换conda环境遇到的问题

1. 生成requirements.txt

pip freeze -> requirements.txt

此时生成的requirements.txt会在自己使用指令的路径里。
在这里插入图片描述
在这里插入图片描述

2. 安装requirements.txt

把requirements.txt复制到指令路径。
因为我是通过pycharm生成的requirements.txt,会附带一些信息,导致报错,ERROR: Could not install packages due to an OSError: [Errno 2]。把多余的信息删掉就可以。
删除前:
在这里插入图片描述

删除后:
在这里插入图片描述
删除后,新建一个环境,就可以安装了

pip install -r requirements.txt

感谢博主 https://blog.csdn.net/qq_42732137/article/details/122198522

3. pytorch特殊情况,OSError: [WinError 126] 找不到指定的模块

因为我是在清华源离线下载的gpu版本,虽然requirements.txt有安装包的信息,但是缺少cudatoolkit,然后就只能去官网重新下载一次

conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch

最后离线安装三个包就可以了,离线安装详情见https://blog.csdn.net/weixin_43868021/article/details/122083729

感谢博主 https://blog.csdn.net/qq_43115981/article/details/115168244


对于pytorch 2.0.1版本,指令为

conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.7 -c pytorch -c nvidia

4. pillow问题

ImportError: DLL load failed while importing _imaging: 找不到指定的模块。
把pillow卸载完,然后重装
参考https://blog.csdn.net/weixin_36815313/article/details/107614883

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值