在Windows上安装pytorch

家住魔仙堡 提交于 2021-02-13 07:22:03

电脑环境为 :windows10 python3.5 cuda8.0

 

可以在官网查询各个版本的安装方式

这里使用pip的安装方式,通过以下命令:

1 pip3 install http://download.pytorch.org/whl/cu80/torch-0.4.0-cp35-cp35m-win_amd64.whl 
2 pip3 install torchvision

在安装完成后在python中验证安装:

Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> import torchvision
>>>

 

 

可能出现的问题:

在import torch时出现 from torch._C import * ImportError: DLL load failed: 找不到指定的模块 的错误

原因是缺少一些dll文件,通过以下几步来解决:

1.下载 win-64/intel-openmp-2018.0.0-8.tar.bz2

 

2.将其解压,并将其Library/bin文件夹中的dll文件全部放入python所在目录的DLLs文件夹下(例如C:\Users\qin\AppData\Local\Programs\Python\Python35\DLLs)

3.将上面的路径添加进环境变量path中。

 

OK,完成

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!