当前位置:网站首页>pytorch安装笔记——Pytorch在conda+CUDA10.2环境安装task01
pytorch安装笔记——Pytorch在conda+CUDA10.2环境安装task01
2022-08-11 05:15:00 【雾切凉宫】
Pytorch在conda+CUDA10.2环境安装
前言
由于之前电脑里安装的CUDA是10.2版本的,paddlepaddle什么的也装的是CUDA10.2的版本,不想再去重装CUDA。
如图:官方已经不支持CUDA10.2的版本了。官网地址:PyTorch

解决
安装过去的版本,点击上面的Previous PyTorch Versions,这里直接给个网址:Previous PyTorch Versions | PyTorch
可以看见有许多过去的版本,也有支持cuda10.2的,大家可以按需找自己要的
完整过程
创建conda虚拟环境
conda create -n env_name python==3.7
激活环境
conda activate env_name
conda换源
方式一 命令行(比较方便)
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/msys2/
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/pkgs/free/
建议把上面那些跑两遍
第一遍只能加channel,第二遍能把他们优先级提到默认源的前面(亲测被坑)
方式二 改文件
TUNA 提供了 Anaconda 仓库与第三方源的镜像,各系统都可以通过修改用户目录下的 .condarc 文件。Windows 用户无法直接创建名为 .condarc 的文件,可先执行conda config --set show_channel_urls yes生成该文件之后再修改。
完成这一步后,我们需要修改C:\Users\User_name\.condarc这个文件,打开后将文件里原始内容删除,将下面的内容复制进去并保存。
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
这一步完成后,我们需要打开Anaconda Prompt 运行 conda clean -i 清除索引缓存,保证用的是镜像站提供的索引。
安装pytorch
根据前面在官网找的支持cuda10.2的安装代码直接安装就好
#conda安装
conda install pytorch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 cudatoolkit=10.2 -c pytorch
#pip安装
pip install torch==1.10.1+cu102 torchvision==0.11.2+cu102 torchaudio==0.10.1 -f https://download.pytorch.org/whl/torch_stable.html
可以看到变成了清华源
然而我自己试下来清华源下pytorch也是300k/s小水管,建议pip
可以看到变成了清华源
[外链图片转存中…(img-5JDl2Wns-1655178124349)]
然而我自己试下来清华源下pytorch也是300k/s小水管,建议pip

成功!
边栏推荐
- ARM Architecture 4: Embedded Hardware Platform Interface Development
- Some common mysql entry exercises
- Idea 2021.3.3版本文件目录展开
- 【转载】CMake 语法 - 详解 CMakeLists.txt
- 实战noVNC全过程操作(包含遇到的问题和解决)
- Solidrun hummingboard制作SD卡
- Redis中RDB和AOF的区别
- selenuim使用cookie登录京东
- Redis - the solution to the failure of connecting to the redis server in linux using jedis
- 一个月闭关直接面进大厂,这份Android面试笔记是真的牛逼
猜你喜欢
随机推荐
[Embedded open source library] The use of cJSON, an efficient and streamlined json parsing library
(一)Docker安装Redis实战(一主二从三哨兵)
pytorch和tensorflow函数对应表
Mysql入门练习
Win10远程连接(实现多用户同时连接)
Delphi7学习记录-demo实例
Tips to improve your productivity, you have to know - Navitcat shortcuts
【网站小白】mySQL数据库异常断开
实战noVNC全过程操作(包含遇到的问题和解决)
Core Data 多线程设计
【win10+cuda7.5+cudnn6.0安装caffe③】编译及测试caffe
[转载]Verilog testbench总结
阿里天池学习赛 新闻文本分类
【动态代理】CGLIB 动态代理的使用及原理
Idea提升工作效率的必备技巧
shell 脚本编程---入门
0708作业---商品信息
Delphi7 learning record - demo example
(二)性能实时监控平台搭建(Grafana+Prometheus+Jmeter)
什么是三次握手和四次挥手(清晰易懂)






![[ARM] rk3399 mounts nfs error](/img/0c/f9f0a2f3850cd55d8bebbee7f898de.png)


