0
点赞
收藏
分享

微信扫一扫

在linux上安装cu10.0 + torch1.2.0对应的pytorch虚拟环境

扶摇_hyber 2022-02-27 阅读 100

1.利用conda命令创建虚拟环境:
conda create -n your_env_name python=xxx(输入你需要的python版本)

出现下面内容的时候,输入y(yes),继续安装
安装虚拟环境

出现一下内容,虚拟环境创建成功
安装成功

2.安装cuda版本对应的pytorch
1)首先,激活各个创建好的环境source(conda) activate your_env_name

2)然后开始安装pytorch

查看之前版本的cuda所对应的pytorch安装命令:
(如果cuda比较新(10.2+)直接进入安装页面)
我是用的是cuda10 + torch 1.2.0
https://pytorch.org/get-started/previous-versions/ 或者点击该链接

找到了对应的linux安装命令(注意对应系统和cuda版本)
pytorch
输入安装命令

pip install torch==1.2.0 torchvision==0.4.0


注:
1)如果pytorch版本和cuda不匹配会出现cuda too old等一系列的报错

2)若出现有些包没有安装成功,是因为有版本不兼容的问题,只需要用pip手动安装就行了 (报错见下图)
手动安装:pip install package_name

报错
报错:pip’s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.

举报

相关推荐

0 条评论