纯小白安装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 分钟前
如何判断专业电子留言厂家适配条件?
大数据·人工智能·python
阿里云大数据AI技术10 分钟前
从 Common Crawl 到可训练语料:用 EMR Serverless Daft 构建清洗、模型标注与向量化管线
人工智能·spark
jay神16 分钟前
27届计算机专业深度学习选题推荐
人工智能·深度学习·yolo·机器学习·计算机视觉
stuartevil17 分钟前
AI漫剧日更制作怎么做才不累
人工智能
大模型任我行20 分钟前
NUS:全模态感知驱动AI科学家
人工智能·语言模型·自然语言处理·论文笔记
会编程的吕洞宾20 分钟前
DeepAgents In Action学习(Third)
python·学习·django
weixin_4462608521 分钟前
G‑MARK:基于知识图谱的协同自动驾驶接地多智能体推理框架
人工智能·自动驾驶·知识图谱
天天进步201523 分钟前
Pixelle-Video 源码解析 #6:AI 文案生成流程:如何根据主题自动写解说词?
人工智能
'20624 分钟前
**写了个自动整理下载视频的脚本:按片名归档、自动重命名、生成目录索引
开发语言·python·ffmpeg·音视频·cctv
章老师说29 分钟前
壬远 AI 网关 v0.4.0 正式发布:模型定价、RMB 配额与多 Key 路由,让企业级 AI 流量治理再进一步
人工智能·ai·开源·负载均衡·ai-native