pytorch的简介
PyTorch既可以看作加入了GPU支持的numpy,同时也可以看成一个拥有自动求导功能的强大的深度神经网络。pytorch百度百科
它是一个基于Python的可续计算包,提供两个高级功能:1、具有强大的GPU加速的张量计算(如NumPy)。2、包含自动求导系统的的深度神经网络。
出现的问题以及解决过程记录
-直接使用pip安装:pip install torch
出现的问题是:Running setup.py install for torch ... error
-使用官网下载的whl包
网址:https://download.pytorch.org/whl/torch_stable.html
在这里要注意版本信息:
cu92: cuda9.2
torch-1.4.0 : torch版本 1.4.0
cp37 : python版本3.7
win: windows 系统
我下载的是:
cu102/torchvision-0.7.0-cp38-cp38-win_amd64.whl
cu102/torch-1.6.0-cp38-cp38-win_amd64.whl
在使用pip安装时再次报错:
torch-1.6.0-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.
此次报错是pip不支持改文件名称,百度之后发现可以通过查看pip支持的文件名格式,改名解决问题。
import pip
print(pip.pep425tags.get_supported())
运行完之后报错:AttributeError: module 'pip' has no attribute 'pep425tags'
再次查找资料,提示64位应该使用:
import pip._internal
print(pip._internal.pep.get_supported())
运行之后仍然报错:AttributeError: module 'pip._internal' has no attribute 'pep425tags'
最后使用了另一个命令查看:
import wheel.pep425tags as w
print(w.get_supported())
#如果第二句报错,使用:
#print(w.get_supported("win_amd64"))
得到结果:
[('cp37', 'cp37m', 'win_amd64'), ('cp37', 'none', 'win_amd64'), ('cp37', 'none', 'any'), ('cp3', 'none', 'any'), ('cp36', 'none', 'any'), ('cp35', 'none', 'any'), ('cp34', 'none', 'any'), ('cp33', 'none', 'any'), ('cp32', 'none', 'any'), ('cp31', 'none', 'any'), ('cp30', 'none', 'any'), ('py3', 'none', 'win_amd64'), ('py37', 'none', 'any'), ('py3', 'none', 'any'), ('py36', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), (