1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > pytorch安装实录(win10+cuda8+pycharm+anaconda)

pytorch安装实录(win10+cuda8+pycharm+anaconda)

时间:2024-06-19 05:33:22

相关推荐

pytorch安装实录(win10+cuda8+pycharm+anaconda)

由于TensorFlow的静态图特点导致最近的一些实验无法完成,决定转战pytorch,自己做一个安装记录,也希望对有需要的小伙伴有所帮助

先前安装的是cuda8.0,并非最新版本,因此需要安装对应版本的pytorch。在pytorch官网上/可以找到最新版本以及之前的版本

在cmd中直接安装即可

有的小伙伴(包括我)会发现直接使用pip安装基本不动,使用镜像也不动(镜像可参考/xo3ylAF9kGs/article/details/104104041/)

这里有一个比较好的解决方法是直接下载轮子,cuda8.0+python3.6可以使用/whl/cu80/torch-1.0.0-cp36-cp36m-win_amd64.whl,更多版本的下载地址可参考/qq_27825451/article/details/90033909

更多轮子/whl/cu100/torch_stable.html

下载到本地后再安装简直不要太快

使用pip install <本地下载地址>即可

接下来是测试是否安装成功的环节

import torch

以及

import torchvision

在这步中,可捕获错误

ImportError: No module named torchvision

这里通过查找资料可以发现与cuda8.0+python3.6+pytorch1.0对应的torchvision版本为0.4

然后安装

pip install torchvision

可以得到如下四种错误

ERROR: Could not find a version that satisfies the requirement torch==1.4.0 (from torchvision) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)ERROR: No matching distribution found for torch==1.4.0 (from torchvision)ERROR: Could not find a version that satisfies the requirement torchvision==0.4 (from versions: 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.2.2, 0.2.2.post2, 0.2.2.post3, 0.3.0, 0.4.1, 0.5.0)ERROR: No matching distribution found for torchvision==0.4

可以在提示信息中发现有0.4.1这个版本,再次尝试

pip3 install torchvision==0.4.1

这里由于某种未知力量,使用了pip3

再次测试

好的,开启pytorch大门!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。