2022525安装pytorch记录

2022525安装pytorch记录

1 关闭杀毒软件!关闭VPN!

报错:
collecting package metadata (current_repodata.json): failed

collecting package metadata (current_repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/current_repodata.json>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
'http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64'

不关闭火绒,换源也无济于事!

2 配置清华源

Anaconda prompt 窗口输入:

conda config --set show_channel_urls yes

生成 .condarc 文件
位置在 C:\Users\xxx
.condarc 文件复制
https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/ 中的
在这里插入图片描述
修改好 .condarc 文件

3 安装

输入以下内容:

conda create -n PyTorch python=3.8

进入pytorch官网:https://pytorch.org/

下载命令

conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch-lts -c conda-forge

安装pytorch。

4 测试

打开 Anaconda prompt 窗口
激活环境

conda activate PyTorch

输入python,进入python开发环境中

python
import torch 
import torchvision
print(torch.__version__) # pytorch版本
print(torch.version.cuda) # cuda版本
print(torch.cuda.is_available()) # 查看cuda是否可用

返回

1.8.2
11.1
True

则PyTorch正常

5 问题

3安装中
报错:

Preparing transaction: done
Verifying transaction: failed

RemoveError: 'requests' is a dependency of conda and cannot be removed from
conda's operating environment.

退出所有虚拟环境再更新
使用下面命令:

conda deactivate
conda update conda

不行使用

conda update --force conda

然后会弹出

是否允许Python.exe

选是
出现done

重新进入环境:

conda cactivate PyTorch 

重新安装pytorch

conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch-lts -c conda-forge

然后返回4验证

结束

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值