安装Pytorch的小坑简记

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/quiet_girl/article/details/79749370

尝试装pytorch,官网上的介绍比较简单,但是安装过程中出现了一些问题,记录一下,不一定对所有机器都适用。

写在前面

环境如下:Ubuntu16.04(自带python2.7)

一、版本问题

最开始使用是Anaconda3-4.3.1,其自带的是python3.6,Pytorch官网上虽然给出了python3.6对应的命令,但是在本机安装不成功,最后安装成功的版本如下:
Anaconda3-4.2.0,自带的是python3.5,相应的pytorch对应的python版本选择python3.5的。

二、使用pip3 install torchvision出现错误

1、问题描述

在使用pip3 install http://download.pytorch.org/whl/cpu/torch-0.3.1-cp35-cp35m-linux_x86_64.whl 成功安装后,使用pip3 install torchvision的时候提示如下错误信息:

Collecting torchvision
  Using cached torchvision-0.2.0-py2.py3-none-any.whl
Collecting numpy (from torchvision)
  Using cached numpy-1.14.2-cp35-cp35m-manylinux1_x86_64.whl
Collecting torch (from torchvision)
  Using cached torch-0.1.2.post1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-kqdxllrv/torch/setup.py", line 11, in <module>
        raise RuntimeError(README)
    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.


    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-kqdxllrv/torch/

2、解决方案

pip3 install torchvision命令换成一下命令即可:

pip3 install --no-deps torchvision

参考文章: https://github.com/pytorch/pytorch/issues/566

猜你喜欢

转载自blog.csdn.net/quiet_girl/article/details/79749370