一.安装
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
二.入门
此教程为翻译官方地址
原文地址:https://www.cnblogs.com/ranjiewen/p/8387050.html
时间: 2024-11-10 16:16:52