纯小白安装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 分钟前
ModelEngine 智能体全流程开发实战:从 0 到 1 搭建多协作办公助手
大数据·人工智能
程序员打怪兽12 分钟前
详解YOLOv8网络结构
人工智能·深度学习
Yuer202513 分钟前
全国首例“AI 幻觉”侵权案判了:这不是 AI 准不准的问题,而是谁该为 AI 负责
人工智能·edca os·可控ai
爱打代码的小林14 分钟前
基于 MediaPipe 实现实时面部关键点检测
python·opencv·计算机视觉
一切尽在,你来28 分钟前
1.1 AI大模型应用开发和Langchain的关系
人工智能·langchain
极客小云33 分钟前
【ComfyUI API 自动化利器:comfyui_xy Python 库使用详解】
网络·python·自动化·comfyui
Coder_Boy_35 分钟前
基于Spring AI的分布式在线考试系统-事件处理架构实现方案
人工智能·spring boot·分布式·spring
闲人编程1 小时前
Elasticsearch搜索引擎集成指南
python·elasticsearch·搜索引擎·jenkins·索引·副本·分片
Light601 小时前
智链未来:彭山物流园区从物理基建到数据智能体的全维度构建方案
人工智能·系统架构·数字孪生·智慧物流·实施路径·彭山项目
AI资源库1 小时前
GLM-4.7-Flash模型深入解析
人工智能·语言模型