Ubuntu16.10安装Pytorch

来源:互联网 发布:家用 网络安全设备 编辑:程序博客网 时间:2024/06/06 07:35

如果你的系统是Linux和OS X,Pytorch的安装很简单,直接去官方网站找合适的下载包就可以了。

可能之前十分呆萌的没有看清楚,安装好了torch7科学计算库,哈哈哈。
安装torch7的教程在这里:torch7安装教程。

Pytorch依赖库的安装

安装pytorch需要两个依赖库,pyyaml和numpy。

sudo pip install pyyamlsudo pip install numpy

进行Pytorch的安装

笔者的是python 2.7 linux 没有安装cuda:

sudo pip install http://download.pytorch.org/whl/cu75/torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whlsudo pip install torchvision# if the above command does not work, then you have python 2.7 UCS2, use this commandpip install http://download.pytorch.org/whl/cu75/torch-0.2.0.post3-cp27-cp27m-manylinux1_x86_64.whl

安装时Terminal的提示:

Processing ./torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whlRequirement already satisfied: pyyaml in /usr/local/lib/python2.7/dist-packages (from torch==0.2.0.post3)Requirement already satisfied: numpy in /usr/local/lib/python2.7/dist-packages (from torch==0.2.0.post3)Installing collected packages: torch

在运行中碰到的问题,解决办法是更新numpy。
问题描述:

ImportError: numpy.core.multiarray failed to import

解决方法:

sudo pip install -U numpy