pytorch安装

环境:ubuntu16.04

(1) install python3

16.04 里面默认安装了python2.7 和3.5

sudo update-alternatives –install /usr/bin/python python /usr/bin/python2 100

sudo update-alternatives –install /usr/bin/python python /usr/bin/python3 150 

如果想要改回Python2 执行如下命令 
sudo update-alternatives –config python 
按照提示输入选择数字回车即可。 

(2) install pip3

sudo apt-get install python3-pip

如果报错”Unable to locate package python3-pip”

前面加一行:

sudo apt-get update

(3) install numpy, scipy, matplotlib

pip3 install numpy

pip3 install scipy

pip3 install matplotlib

(4) install pytorch

pip3 install http://download.pytorch.org/whl/cu75/torch-0.2.0.post3-cp35-cp35m-manylinux1_x86_64.whl 
pip3 install torchvision

RuntimeError: PyTorch does not currently provide packages for PyPI (see status at https://github.com/pytorch/pytorch/issues/566).
    
Please follow the instructions at http://pytorch.org/ to install with miniconda instead.

(5) anaconda pytorch

 1. 去anaconda官网下载安装包,注意和机器上的python版本保持一致,不然安装annaconda过程中会报错。

python3.5 对应的版本号为anaconda3 4.2.0

2. bash ana*.sh

3. 没有独立显卡,anaconda安装,python3.5

命令:conda install pytorch torchvision -c soumith

    原文作者:pytorch
    原文地址: https://www.cnblogs.com/shadowwalker9/p/7624356.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞