Anaconda配置pytorch环境

本文介绍了如何在Anaconda环境下配置PyTorch,包括添加环境变量,创建虚拟环境,使用清华源加速下载,以及安装遇到的问题和解决方案,如安装matplotlib、tensorboardX等依赖库时的兼容性问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

主要参考:(11条消息) Anaconda下的pytorch环境配置_LEiJx27的博客-CSDN博客_anaconda配置pytorch环境

anaconda添加环境变量

D:\Anaconda(Python需要)

D:\Anaconda\Scripts(conda自带脚本)

D:\Anaconda\Library\mingw-w64\bin(使用C with python的时D:\Anaconda\Library\bin(jupyter notebook动态库)

创建虚拟环境:
conda create -n <env name> python=3.7

-n写成-name创建出来环境名直接是ame,吓坏我

安装pytorch:
conda install pytorch torchvision torchaudio cpuonly -c pytorch

安装失败,报错如下

原因好像是官网源下载太慢超时,用清华源

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/

然后直接

conda install pytorch
安装pyG:

可恶啊不支持windows pytorch1.13.*,只好再安装pytorch1.12

Note:后面发现我后来的环境安的竟然是pytorch1.11

上面的方法好像只能下最新的,所以直接把要安装的包下到本地,然后

conda install --offline .\cudnn-7.0.5-cuda8.0_0.tar.bz2   (具体下载路径)
jupyter notebook——命令行打开

需要到iypnb文件所在位置,再输入命令,将用默认浏览器打开

cd /d D:\
jupyter notebook
安装matplotlib:
conda install matplotlib

开了vpn会安装失败,得关了

安装tensorboardX:

安装tensorboard还是得先安装tensorflow

conda install tensorflow==1.14

tensorboardX需要1.15以上的tensorboard(不指定版本默认安装1.14的)

pip install tensorboard==1.15

出错:

tensorflow 1.14.0 requires google-pasta>=0.1.6, which is not installed.

tensorflow 1.14.0 requires tensorboard<1.15.0,>=1.14.0, but you have tensorboard 1.15.0 which is incompatible.

又重新安了tensorflow 1.15

pip install tensorboardX
安装 scikit-dsp-comm :

参考:Scikit Dsp Comm :: Anaconda.org

conda install -c conda-forge scikit-dsp-comm

在shell里乱搞

conda init

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值