当前位置: 代码迷 >> 综合 >> Linux Ubuntu 16.04 CUDA10.1安装Pytorch
  详细解决方案

Linux Ubuntu 16.04 CUDA10.1安装Pytorch

热度:16   发布时间:2023-12-15 17:15:56.0

【环境】

linux ubuntu 16.04 python3.5 

【步骤】

1,安装显卡驱动和CUDA10.1:https://blog.csdn.net/qxqxqzzz/article/details/102794226

2,安装torch, torchvision: 

# 查看和卸载之前的老版本(如果有)
$ pip3 listPackage                       Version
----------------------------- -----------
absl-py                       0.8.0
apturl                        0.5.2
astor                         0.8.0
attrs                         19.3.0
backcall                      0.1.0
bcolz                         1.2.1
beautifulsoup4                4.4.1
bleach                        3.1.0
blinker                       1.3
Bottleneck                    1.2.1
Brlapi                        0.6.4
certifi                       2019.9.11
chardet                       2.3.0
checkbox-support              0.22
command-not-found             0.3
cryptography                  1.2.3
cycler                        0.10.0
Cython                        0.29.13
decorator                     4.4.0
defer                         1.0.6
defusedxml                    0.6.0
descartes                     1.1.0
entrypoints                   0.3
feather-format                0.4.0
feedparser                    5.1.3
gast                          0.2.2
google-pasta                  0.1.7
graphviz                      0.13
grpcio                        1.24.1
guacamole                     0.9.2
h5py                          2.10.0
html5lib                      0.999
httplib2                      0.9.1
idna                          2.0
imageio                       2.5.0
imgaug                        0.3.0
importlib-metadata            0.23
ipykernel                     5.1.3
ipython                       7.8.0
ipython-genutils              0.2.0
ipywidgets                    7.5.1
isoweek                       1.3.3
jedi                          0.15.1
Jinja2                        2.8
joblib                        0.13.2
jsonschema                    3.1.1
jupyter                       1.0.0
jupyter-client                5.3.4
jupyter-console               6.0.0
jupyter-core                  4.6.1
Keras-Applications            1.0.8
Keras-Preprocessing           1.1.0
kiwisolver                    1.1.0
language-selector             0.1
louis                         2.6.4
lxml                          3.5.0
Mako                          1.0.3
Markdown                      3.1.1
MarkupSafe                    0.23
matplotlib                    3.0.3
mistune                       0.8.4
mizani                        0.5.4
more-itertools                7.2.0
nbconvert                     5.6.1
nbformat                      4.4.0
networkx                      2.3
notebook                      6.0.1
numpy                         1.17.3
oauthlib                      1.0.3
onboard                       1.2.0
opencv-python                 4.1.1.26
opt-einsum                    3.1.0
padme                         1.1.1
palettable                    3.3.0
pandas                        0.24.2
pandas-summary                0.0.7
pandocfilters                 1.4.2
parso                         0.5.1
patsy                         0.5.1
pexpect                       4.0.1
pickleshare                   0.7.5
Pillow                        6.2.1
pip                           19.2.3
plainbox                      0.25
plotnine                      0.5.1
progressbar                   2.5
progressbar2                  3.46.1
prometheus-client             0.7.1
prompt-toolkit                2.0.9
protobuf                      3.10.0
ptyprocess                    0.5
pyarrow                       0.15.0
pyasn1                        0.1.9
pycups                        1.9.73
pycurl                        7.43.0
Pygments                      2.4.2
pygobject                     3.20.0
PyJWT                         1.3.0
pyparsing                     2.0.3
pypng                         0.0.20
pyrsistent                    0.15.5
python-apt                    1.1.0b1
python-dateutil               2.8.0
python-debian                 0.1.27
python-systemd                231
python-utils                  2.3.0
pytz                          2014.10
PyWavelets                    1.0.3
pyxdg                         0.25
PyYAML                        5.1.2
pyzmq                         18.1.0
qtconsole                     4.5.5
reportlab                     3.3.0
requests                      2.9.1
scikit-image                  0.15.0
scikit-learn                  0.21.3
scipy                         1.3.1
screen-resolution-extra       0.0.0
seaborn                       0.9.0
Send2Trash                    1.5.0
sessioninstaller              0.0.0
setuptools                    39.1.0
Shapely                       1.6.4.post2
simplegeneric                 0.8.1
six                           1.12.0
sklearn                       0.0
sklearn-pandas                1.8.0
ssh-import-id                 5.5
statsmodels                   0.10.1
system-service                0.3
tensorboard                   1.10.0
tensorboardX                  1.8
tensorflow-estimator          2.0.0
tensorflow-gpu                1.10.0
termcolor                     1.1.0
terminado                     0.8.2
testpath                      0.4.2
torch                         0.4.1
torchtext                     0.4.0
torchvision                   0.2.2.post3
tornado                       6.0.3
tqdm                          4.36.1
traitlets                     4.3.2
ubuntu-drivers-common         0.0.0
ufw                           0.35
unattended-upgrades           0.1
unity-scope-calculator        0.1
unity-scope-chromiumbookmarks 0.1
unity-scope-colourlovers      0.1
unity-scope-devhelp           0.1
unity-scope-firefoxbookmarks  0.1
unity-scope-gdrive            0.7
unity-scope-manpages          0.1
unity-scope-openclipart       0.1
unity-scope-texdoc            0.1
unity-scope-tomboy            0.1
unity-scope-virtualbox        0.1
unity-scope-yelp              0.1
unity-scope-zotero            0.1
urllib3                       1.13.1
usb-creator                   0.3.0
virtualenv                    15.0.1
wcwidth                       0.1.7
webencodings                  0.5.1
Werkzeug                      0.16.0
wheel                         0.29.0
widgetsnbextension            3.5.1
wrapt                         1.11.2
xdiagnose                     3.8.4
xkit                          0.0.0
XlsxWriter                    0.7.3
zipp                          0.6.0# 卸载老版本
$ sudo pip3 uninstall torch torchvision

 

# 安装新版本 (内网环境),按照:https://pytorch.org/get-started/locally/ 指示说明
$ pip3 --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --trusted-host=download.pytorch.org install torch torchvision --user

【参考】https://pytorch.org/get-started/locally/