为了查看pytorch老版本中的一些代码,需要在环境库中安装pytorch0.4.1
1、准备需要离线安装的文件 pytorch 0.4.1
下载地址:https://download.pytorch.org/whl/cu90/torch_stable.html
在页面中找到对应版本并存放在d:\\下,本文使用 torch-0.4.1-cp36-cp36m-win_amd64.whl
2、新建环境
以管理员身份打开anaconda promt
输入:conda create -n env_pytorch041 python=3.6.13 #这里版本有要求,查看附表
新建的时候出现错误,因为镜像源引起的,需要更换镜像源,这里修改为清华大学镜像
3、安装pytorch
输入:conda env list
输入:activate pytorch041 #创建的环境名称
输入:pip install d:\\torch-0.4.1-cp36-cp36m-win_amd64.whl
返回:Successfully installed torch-0.4.1
4、安装torchvision
输入:pip install torchvision==0.2.1 #这里版本有要求,查看附表
返回:Successfully installed torchvision-0.2.1
安装成功。可以新建项目并引用该环境,环境引用方法深度学习环境搭建 在pycharm中引用anaconda3_mustanger的博客-CSDN博客
以下对照表来自https://github.com/pytorch/vision
The following is the corresponding torchvision
versions and supported Python versions.
torch | torchvision | python |
---|---|---|
main / nightly | main / nightly | >=3.8 , <=3.11 |
2.0.0 | 0.15.1 | >=3.8 , <=3.11 |
1.13.0 | 0.14.0 | >=3.7.2 , <=3.10 |
1.12.0 | 0.13.0 | >=3.7 , <=3.10 |
1.11.0 | 0.12.0 | >=3.7 , <=3.10 |
1.10.2 | 0.11.3 | >=3.6 , <=3.9 |
1.10.1 | 0.11.2 | >=3.6 , <=3.9 |
1.10.0 | 0.11.1 | >=3.6 , <=3.9 |
1.9.1 | 0.10.1 | >=3.6 , <=3.9 |
1.9.0 | 0.10.0 | >=3.6 , <=3.9 |
1.8.2 | 0.9.2 | >=3.6 , <=3.9 |
1.8.1 | 0.9.1 | >=3.6 , <=3.9 |
1.8.0 | 0.9.0 | >=3.6 , <=3.9 |
1.7.1 | 0.8.2 | >=3.6 , <=3.9 |
1.7.0 | 0.8.1 | >=3.6 , <=3.8 |
1.7.0 | 0.8.0 | >=3.6 , <=3.8 |
1.6.0 | 0.7.0 | >=3.6 , <=3.8 |
1.5.1 | 0.6.1 | >=3.5 , <=3.8 |
1.5.0 | 0.6.0 | >=3.5 , <=3.8 |
1.4.0 | 0.5.0 | ==2.7 , >=3.5 , <=3.8 |
1.3.1 | 0.4.2 | ==2.7 , >=3.5 , <=3.7 |
1.3.0 | 0.4.1 | ==2.7 , >=3.5 , <=3.7 |
1.2.0 | 0.4.0 | ==2.7 , >=3.5 , <=3.7 |
1.1.0 | 0.3.0 | ==2.7 , >=3.5 , <=3.7 |
<=1.0.1 | 0.2.2 | ==2.7 , >=3.5 , <=3.7 |