Ubuntu16.04安装Pytorch

Posted 小河沟大河沟

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu16.04安装Pytorch相关的知识,希望对你有一定的参考价值。

一.安装

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
[email protected]:~$ 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的主要内容,如果未能解决你的问题,请参考以下文章

ubuntu16.04下安装深度学习框架

Ubuntu16.04下安装多版本cuda和cudnn

自定义基于Ubuntu16.04的cuda10 + pytorch1.5基础镜像包

ubuntu16.04 yum报错:There are no enabled repos. Run “yum repolist all“ to see the repos you have.(代码片段

pytorch安装

pytorch 0.4.1安装问题