1. 程式人生 > >Ubuntu16.04安裝Pytorch

Ubuntu16.04安裝Pytorch

std tails last line 網絡錯誤 set bsp stat install

一.安裝

1. 官方github:https://github.com/pytorch/pytorch

Install optional dependencies

On Linux

export CMAKE_PREFIX_PATH="$(dirname $(which conda))/../" # [anaconda root directory]

# Install basic dependencies
conda install numpy pyyaml mkl setuptools cmake cffi

# Add LAPACK support for the GPU
conda install 
-c pytorch magma-cuda80 # or magma-cuda90 if CUDA 9

- 出現網絡錯誤

Downloading and Extracting Packages
certifi 2018.1.18: ##################################################### | 100% 
magma-cuda80 2.2.0:                                                      |   0% 

CondaHTTPError: HTTP 000 CONNECTION FAILED for
url <https://conda.anaconda.org/pytorch/linux-64/magma-cuda80-2.2.0-h39f1f8d_1.tar.bz2> Elapsed: - An HTTP error occurred when trying to retrieve this URL. HTTP errors are often intermittent, and a simple retry will get you on your way.

- 根據:Previous Versions

Installation instructions and binaries for previous PyTorch versions may be found on our website.

Installing with CUDA 8

conda install pytorch=0.1.12 cuda80 -c soumith

- 安裝成功,但是運行出錯

Downloading and Extracting Packages
cuda80 1.0: ############################################################ | 100% 
libgcc 7.2.0: ########################################################## | 100% 
pytorch 0.1.12: ######################################################## | 100% 
libtorch 0.1.12: ####################################################### | 100% 
openblas 0.2.19: ####################################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
dsp@dsp:~$ python
Python 2.7.14 |Anaconda custom (64-bit)| (default, Oct 16 2017, 17:29:19) 
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/dsp/anaconda2/lib/python2.7/site-packages/torch/__init__.py", line 53, in <module>
    from torch._C import *
ImportError: /home/dsp/anaconda2/lib/python2.7/site-packages/torch/_C.so: undefined symbol: _ZN4thpp10THCSTensorIlEC1EP8THCStateP14THCSLongTensor

二.入門

此教程為翻譯官方地址

Github 地址
簡書地址
CSDN地址

作者:Soumith Chintala

Ubuntu16.04安裝Pytorch