Ubuntu16.04安装Pytorch

来源:互联网 发布:淘宝企业店铺能转让吗 编辑:程序博客网 时间:2024/05/21 04:24
如果你的系统是Linux和OS X ,Pytorch的安装很简单,直接去官方网站http://pytorch.org/找命令就可以了。

(可能之前十分呆萌的没有看清楚,安装好了torch7科学计算库.哈哈哈.
安装torch7的教程在这里:http://blog.csdn.net/hungryof/article/details/51557666.)

一、Pytorch依赖库的安装
安装pytorch需要两个依赖库,pyyaml和numpy。
sudo pip install pyyaml
sudo 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.whl
sudo pip install torchvision

# if the above command does not work, then you have python 2.7 UCS2, use this command
pip 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.whl
Requirement 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