win10 下 Anaconda 安装 Pytorch 遇到的一些问题

今天尝试在win10下安装pytorch,通过anaconda工具直接安装pytorch基本没有什么问题, import torch成功,但是总会有一点意外。import torchvision出现No module的错误。后了解到torchvision不能通过conda直接安装,只能pip,起始采用pip3下载,下载之后安装之后。仍然不能import torchvision,后了解到后pillow版本过高之说,本人安装pillow==6.0.0于是卸载pillow,安装pillow==4.1.1。

 仍不能解决问题。遂采用pip下载,pip install torchvision 这时出现:

Collecting torchvision
  Downloading https://files.pythonhosted.org/packages/78/8d/b92dc9543bc51f7fcaf8d953d814770d1e471ee93c4eff19a76f9b9b510b/torchvision-0.3.0-cp36-cp36m-win_amd64.whl (1.3MB)
     |████████████████████████████████| 1.3MB 11kB/s
Collecting six (from torchvision)
  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting torch>=1.1.0 (from torchvision)
  ERROR: Could not find a version that satisfies the requirement torch>=1.1.0 (from torchvision) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch>=1.1.0 (from torchvision)

发现 torch的版本与torchvision版本不匹配,遂降低torchvision版本为0.2.0 出现Successfully installed six-1.12.0 torchvision-0.2.0。至此安装成功

import torch 

import torchvision

查看安装的版本 pip list 

certifi      2019.6.16
cffi         1.12.3
mkl-fft      1.0.12
mkl-random   1.0.2
numpy        1.16.4
olefile      0.46
Pillow       4.1.1
pip          19.1.1
pycparser    2.19
setuptools   41.0.1
six          1.12.0
torch        1.0.1
torchvision  0.2.0
wheel        0.33.4
wincertstore 0.2

发现pillow为4.1.1 遂更新pillow至6.1.0 发现 也能将torchvision导入成功。

 certifi      2019.6.16
cffi         1.12.3
mkl-fft      1.0.12
mkl-random   1.0.2
numpy        1.16.4
olefile      0.46
Pillow       6.1.0
pip          19.1.1
pycparser    2.19
setuptools   41.0.1
six          1.12.0
torch        1.0.1
torchvision  0.2.0
wheel        0.33.4
wincertstore 0.2

总结:

在整个安装过程中,主要涉及到安装资源,以及版本匹配成最大阻碍,初次安装容易跳坑。

 

参考:

http://www.mamicode.com/info-detail-2424578.html

https://blog.csdn.net/guoqiangszu/article/details/83302619

https://blog.csdn.net/xwy990/article/details/80995893

https://blog.csdn.net/buaa1406/article/details/83104158

https://blog.csdn.net/red_stone1/article/details/86669362

你可能感兴趣的:(win10 下 Anaconda 安装 Pytorch 遇到的一些问题)