纯小白安装pytorch(快速上手)

1.首先进入你的虚拟环境(不进入也没关系)

复制代码
在anaconda prompt中打开,输入activate 虚拟环境

2.查看自己的conda源

复制代码
conda config --show channels

3.清空自己的conda源

复制代码
conda config --remove-key channels

4.添加源

bash 复制代码
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --set show_channel_urls yes

5.去Pytorch官网下载对应的cuda版本的pytorch

bash 复制代码
conda install pytorch==1.8.1 torchvision==0.9.1 torchaudio==0.8.1 cudatoolkit=11.3

我的cuda版本是11.6(使用nvidia-smi),我选择比11.6版本低一些的带cuda版本的pytorch

6.如果遇到如下问题的解决办法

问题一

bash 复制代码
 CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/mkl-2023.1.0-h6b88ed4_463 58.conda> 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.

解决办法

首先检查自己的网是否是通的

bash 复制代码
ping www.baidu.com

通的话就不用管,不通就看一下如何修复(本人没有遇到此问题)

检查防火墙,然后关闭防火墙

bash 复制代码
# 在管理员的身份运行cmd窗口
netsh advfirewall set allprofiles state off

如果关闭防火墙还不行,则把ssl证书给关闭

1.首先在anaconda prompt命令窗口中查看自己的ssl证书

bash 复制代码
conda config --show|grep ssl*

2.然后关闭ssl

bash 复制代码
conda config --set ssl_verify no

3.想开启的话命令就是

bash 复制代码
conda config --set ssl_verify yes

以上就应该能解决报错的问题了

相关推荐
桜吹雪5 分钟前
手搓一个简易Agent
前端·人工智能·后端
1***s63218 分钟前
Python爬虫反爬策略,User-Agent与代理IP
开发语言·爬虫·python
数字时代全景窗18 分钟前
从App时代到智能体时代,如何打破“三堵墙”
人工智能·软件工程
weixin_4691636920 分钟前
金融科技项目管理方式在AI加持下发展方向之,需求分析精准化减少业务与技术偏差
人工智能·科技·金融·项目管理·需求管理
老蒋新思维39 分钟前
借陈修超之智,搭建 AI 与 IP 的创新增长桥梁|创客匠人
网络·人工智能·网络协议·tcp/ip·ip·知识付费·创客匠人
点PY1 小时前
TR3D: Towards Real-Time Indoor 3D Object Detection论文精读
人工智能·目标检测·3d
咖啡の猫1 小时前
Python的自述
开发语言·python
九年义务漏网鲨鱼1 小时前
【大模型面经】千问系列专题面经
人工智能·深度学习·算法·大模型·强化学习
北京耐用通信1 小时前
“耐达讯自动化Profibus总线光端机在化工变频泵控制系统中的应用与价值解析”
人工智能·科技·物联网·网络安全·自动化·信息与通信