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

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

相关推荐
程序员cxuan7 分钟前
我用 WorkBuddy + ima 把公众号文章做成了知识库。
人工智能·后端·程序员
Code_Artist11 分钟前
AI 终于学会写正确的汉字了?GPT Image 2.0 到底做对了什么?
人工智能·chatgpt·openai
程序员cxuan36 分钟前
玩了一天 REA,我号快没了
人工智能·后端·程序员
阿里云大数据AI技术42 分钟前
聚数成湖,以智驭行:卓驭如何构建移动物理 AI 的数据底座
人工智能·spark
卷无止境44 分钟前
暗流与破局:AI时代的代码安全审查工具全景指南
后端·python
武子康2 小时前
150毫秒和2400毫秒:同一 Agent 任务的两种延迟
人工智能·后端·agent
暖心hebbie设计学习2 小时前
GitHub 热榜周报(10.19)|5 个把 AI 装回本地的开源项目:多 agent 控制台、本地语音、节点式生成(含技术看点)
人工智能·github
猪脚踏浪2 小时前
open webui 在docker容器里跑,并且是在内网断绝互联网的环境下。生成ppt
人工智能
海边捡石子2 小时前
FreeSWITCH 入门:把电话系统接入语音客服机器人
人工智能·后端
桃西西呀2 小时前
我把网关限流配置成每秒 100 请求,大促一来照样被打挂,还把别人也拖垮了
人工智能·llm·ai编程