纯小白安装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

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

相关推荐
网络毒刘9 分钟前
开源 AI 编程助手横向对比(Cursor / Continue / Aider):能力边界与 AtomGit 落地建议
人工智能·开源
DP DPharness27 分钟前
HelloAGENTS 的 14 项技能与 ~ 命令路由是怎么组织的
人工智能·dpharness
旋生万物27 分钟前
螺旋角分布的功率谱分析:多窗谱 + FDR 校正
开发语言·python
归秋14229 分钟前
多轨音频智能混音软件怎么选:从 demo 到更完整作品的 AI 后期工具思路
人工智能·音视频
DP DPharness32 分钟前
装完看不到模型?dsh-commandcode-provider 排错速查
人工智能·dpharness
天国梦34 分钟前
哪个英语教学软件功能比较全面?我按五个维度拆了一遍
人工智能·机器学习
专业程序开发源1 小时前
SSM校园拍摄交流服务平台36936-计算机课程设计、毕业设计
java·spring boot·后端·python·elasticsearch·php·课程设计
tomlone1 小时前
AI 实践:OpenClaw + 本地 Ollama + Qwen3.5
人工智能·自然语言处理·ai写作
盘古开天16661 小时前
windows鱼塘可交互鱼群动态桌面资源
人工智能·chatgpt·开源
wuyk5551 小时前
Python 网络爬虫入门到实战 第 04 章:请求头、UA 伪装、超时、异常处理、基础反爬绕过
开发语言·爬虫·python