栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

2022525安装pytorch记录

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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 
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:Usersxxx
.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验证

结束

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/932448.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号