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

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

相关推荐
shayudiandian14 分钟前
RNN与LSTM详解:AI是如何“记住”信息的?
人工智能·rnn·lstm
美人鱼战士爱学习25 分钟前
2025 Large language models for intelligent RDF knowledge graph construction
人工智能·语言模型·知识图谱
jz_ddk26 分钟前
[算法] 算法PK:LMS与RLS的对比研究
人工智能·神经网络·算法·信号处理·lms·rls·自适应滤波
qinyia27 分钟前
使用Wisdom SSH的AI多会话功能进行批量命令执行和跨服务器智能运维
运维·人工智能·ssh
谅望者37 分钟前
数据分析笔记14:Python文件操作
大数据·数据库·笔记·python·数据挖掘·数据分析
l1t41 分钟前
调用python函数的不同方法效率对比测试
开发语言·数据库·python·sql·duckdb
YisquareTech1 小时前
如何实现智能补货?EDI与ERP集成打造零售库存的“自动闭环”
大数据·人工智能·零售·伊士格科技·erp集成
观远数据1 小时前
数据驱动零售新生态:观远BI打造终端经营“透视镜”
大数据·人工智能·信息可视化·数据分析·零售
2501_941111401 小时前
使用Scrapy框架构建分布式爬虫
jvm·数据库·python
思通数科人工智能大模型1 小时前
零售场景下的数智店商:解决盗损问题,化解隐性成本痛点
人工智能·目标检测·计算机视觉·数据挖掘·知识图谱·零售