跟李沐学Ai 03 安装【动手学深度学习v2】

跟李沐学Ai  03 安装【动手学深度学习v2】

可以考虑直接使用Google的colab,https://colab.research.google.com/drive/18-HoW6P3L6N0rWBWLc-b6xB83cD3cZZn

命令1 sudo apt update
[sudo] password for clu: 
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease            
Hit:2 http://us.archive.ubuntu.com/ubuntu bionic InRelease                   
Hit:3 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
704 packages can be upgraded. Run 'apt list --upgradable' to see them.

命令2 sudo apt install build-essential

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  cpp cpp-7 dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-7-base gcc-8-base
  libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl
  libasan4 libatomic1 libc-dev-bin libc6 libc6-dbg libc6-dev libcc1-0
  libcilkrts5 libdpkg-perl libfakeroot libgcc-7-dev libgcc1 libgomp1 libitm1
  liblsan0 libmpx2 libquadmath0 libstdc++-7-dev libstdc++6 libtsan0 libubsan0
  linux-libc-dev make manpages-dev
Suggested packages:
  cpp-doc gcc-7-locales debian-keyring g++-multilib g++-7-multilib gcc-7-doc
  libstdc++6-7-dbg gcc-multilib autoconf automake libtool flex bison gcc-doc
  gcc-7-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg
  libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg
  libmpx2-dbg libquadmath0-dbg glibc-doc git bzr libstdc++-7-doc make-doc
The following NEW packages will be installed:
  build-essential dpkg-dev fakeroot g++ g++-7 gcc gcc-7 libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libatomic1
  libc-dev-bin libc6-dev libcilkrts5 libfakeroot libgcc-7-dev libitm1 liblsan0
  libmpx2 libquadmath0 libstdc++-7-dev libtsan0 libubsan0 linux-libc-dev make
  manpages-dev
The following packages will be upgraded:
  cpp cpp-7 gcc-7-base gcc-8-base libc6 libc6-dbg libcc1-0 libdpkg-perl
  libgcc1 libgomp1 libstdc++6
11 upgraded, 27 newly installed, 0 to remove and 693 not upgraded.
Need to get 39.1 MB/48.3 MB of archives.
After this operation, 122 MB of additional disk space will be used.

命令3   sudo apt install python3.8
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libpython3.8-minimal libpython3.8-stdlib libssl1.1 python3.8-minimal
Suggested packages:
  python3.8-venv python3.8-doc binfmt-support
The following NEW packages will be installed:
  libpython3.8-minimal libpython3.8-stdlib python3.8 python3.8-minimal
The following packages will be upgraded:
  libssl1.1
1 upgraded, 4 newly installed, 0 to remove and 692 not upgraded.

安装Miniconda https://docs.conda.io/en/latest/miniconda.html

https://docs.conda.io/en/latest/miniconda.html#linux-installers

命令4  wget https://repo.anaconda.com/miniconda/Miniconda3-py38_4.10.3-Linux-x86_64.sh

命令5 bash Miniconda3-py38_4.10.3-Linux-x86_64.sh

Miniconda3 will now be installed into this location:
/home/clu/miniconda3

命令6 pip install jupyter d2l torch torchvision

torch 881.9 MB 太大了

https://zh-v2.d2l.ai/  下载Jupyter记事本  大小85MB

命令7 wget https://zh-v2.d2l.ai/d2l-zh.zip

视频9分10秒左右

命令8 sudo apt install zip

命令9  unzip d2l-zh.zip 解压

解压出来3个文件夹,mxnet,pytorch,tensorflow

课程安排https://courses.d2l.ai/zh-v2/

命令10  sudo apt install git

命令11 git clone --depth=1 https://github.com/d2l-ai/d2l-zh-pytorch-slides.git

命令12 jupyter notebook

命令13 pip install rise辅助来看幻灯片

在线教程 https://zh-v2.d2l.ai/chapter_linear-networks/linear-regression-concise.html,右上角有colab的链接。

https://colab.research.google.com/github/d2l-ai/d2l-zh-colab/blob/master/chapter_linear-networks/linear-regression-concise.ipynb

pip install jupyter d2l torch torchvision

Collecting jupyter
  Downloading jupyter-1.0.0-py2.py3-none-any.whl (2.7 kB)
Collecting d2l
  Downloading d2l-0.17.0-py3-none-any.whl (83 kB)
     |████████████████████████████████| 83 kB 1.6 MB/s 
Collecting torch
  Downloading torch-1.10.0-cp38-cp38-manylinux1_x86_64.whl (881.9 MB)
     |████████████████████████████████| 881.9 MB 9.4 kB/s 
Collecting torchvision
  Downloading torchvision-0.11.1-cp38-cp38-manylinux1_x86_64.whl (23.3 MB)
     |████████████████████████████████| 23.3 MB 701 kB/s 
Collecting notebook
  Downloading notebook-6.4.5-py3-none-any.whl (9.9 MB)
     |████████████████████████████████| 9.9 MB 528 kB/s 
Collecting qtconsole
  Downloading qtconsole-5.1.1-py3-none-any.whl (119 kB)
     |████████████████████████████████| 119 kB 716 kB/s 
Collecting nbconvert
  Downloading nbconvert-6.2.0-py3-none-any.whl (553 kB)
     |████████████████████████████████| 553 kB 752 kB/s 
Collecting ipywidgets
  Downloading ipywidgets-7.6.5-py2.py3-none-any.whl (121 kB)
     |████████████████████████████████| 121 kB 1.2 MB/s 
Collecting ipykernel
  Downloading ipykernel-6.5.0-py3-none-any.whl (125 kB)
     |████████████████████████████████| 125 kB 1.3 MB/s 
Collecting jupyter-console
  Downloading jupyter_console-6.4.0-py3-none-any.whl (22 kB)
Collecting matplotlib
  Downloading matplotlib-3.4.3-cp38-cp38-manylinux1_x86_64.whl (10.3 MB)
     |████████████████████████████████| 10.3 MB 827 kB/s 
Requirement already satisfied: requests in ./miniconda3/lib/python3.8/site-packages (from d2l) (2.25.1)
Collecting pandas
  Downloading pandas-1.3.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB)
     |████████████████████████████████| 11.5 MB 636 kB/s 
Collecting numpy
  Downloading numpy-1.21.3-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (15.7 MB)
     |████████████████████████████████| 15.7 MB 247 kB/s 
Collecting typing-extensions
  Downloading typing_extensions-3.10.0.2-py3-none-any.whl (26 kB)
Collecting pillow!=8.3.0,>=5.3.0
  Downloading Pillow-8.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB)
     |████████████████████████████████| 3.1 MB 812 kB/s 
Collecting jupyter-client<8.0
  Downloading jupyter_client-7.0.6-py3-none-any.whl (125 kB)
     |████████████████████████████████| 125 kB 370 kB/s 
Collecting ipython<8.0,>=7.23.1
  Downloading ipython-7.29.0-py3-none-any.whl (790 kB)
     |████████████████████████████████| 790 kB 678 kB/s 
Collecting tornado<7.0,>=4.2
  Downloading tornado-6.1-cp38-cp38-manylinux2010_x86_64.whl (427 kB)
     |████████████████████████████████| 427 kB 679 kB/s 
Collecting traitlets<6.0,>=5.1.0
  Downloading traitlets-5.1.1-py3-none-any.whl (102 kB)
     |████████████████████████████████| 102 kB 778 kB/s 
Collecting matplotlib-inline<0.2.0,>=0.1.0
  Downloading matplotlib_inline-0.1.3-py3-none-any.whl (8.2 kB)
Collecting debugpy<2.0,>=1.0.0
  Downloading debugpy-1.5.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.9 MB)
     |████████████████████████████████| 1.9 MB 687 kB/s 
Collecting jedi>=0.16
  Downloading jedi-0.18.0-py2.py3-none-any.whl (1.4 MB)
     |████████████████████████████████| 1.4 MB 895 kB/s 
Collecting prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0
  Downloading prompt_toolkit-3.0.21-py3-none-any.whl (374 kB)
     |████████████████████████████████| 374 kB 1.2 MB/s 
Collecting pexpect>4.3
  Downloading pexpect-4.8.0-py2.py3-none-any.whl (59 kB)
     |████████████████████████████████| 59 kB 1.6 MB/s 
Collecting pygments
  Downloading Pygments-2.10.0-py3-none-any.whl (1.0 MB)
     |████████████████████████████████| 1.0 MB 1.4 MB/s 
Collecting decorator
  Downloading decorator-5.1.0-py3-none-any.whl (9.1 kB)
Collecting backcall
  Downloading backcall-0.2.0-py2.py3-none-any.whl (11 kB)
Requirement already satisfied: setuptools>=18.5 in ./miniconda3/lib/python3.8/site-packages (from ipython<8.0,>=7.23.1->ipykernel->jupyter) (52.0.0.post20210125)
Collecting pickleshare
  Downloading pickleshare-0.7.5-py2.py3-none-any.whl (6.9 kB)
Collecting parso<0.9.0,>=0.8.0
  Downloading parso-0.8.2-py2.py3-none-any.whl (94 kB)
     |████████████████████████████████| 94 kB 1.9 MB/s 
Collecting nest-asyncio>=1.5
  Downloading nest_asyncio-1.5.1-py3-none-any.whl (5.0 kB)
Collecting python-dateutil>=2.1
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     |████████████████████████████████| 247 kB 1.8 MB/s 
Collecting entrypoints
  Downloading entrypoints-0.3-py2.py3-none-any.whl (11 kB)
Collecting pyzmq>=13
  Downloading pyzmq-22.3.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.1 MB)
     |████████████████████████████████| 1.1 MB 2.0 MB/s 
Collecting jupyter-core>=4.6.0
  Downloading jupyter_core-4.9.1-py3-none-any.whl (86 kB)
     |████████████████████████████████| 86 kB 461 kB/s 
Collecting ptyprocess>=0.5
  Downloading ptyprocess-0.7.0-py2.py3-none-any.whl (13 kB)
Collecting wcwidth
  Downloading wcwidth-0.2.5-py2.py3-none-any.whl (30 kB)
Requirement already satisfied: six>=1.5 in ./miniconda3/lib/python3.8/site-packages (from python-dateutil>=2.1->jupyter-client<8.0->ipykernel->jupyter) (1.16.0)
Collecting nbformat>=4.2.0
  Downloading nbformat-5.1.3-py3-none-any.whl (178 kB)
     |████████████████████████████████| 178 kB 558 kB/s 
Collecting jupyterlab-widgets>=1.0.0
  Downloading jupyterlab_widgets-1.0.2-py3-none-any.whl (243 kB)
     |████████████████████████████████| 243 kB 359 kB/s 
Collecting widgetsnbextension~=3.5.0
  Downloading widgetsnbextension-3.5.2-py2.py3-none-any.whl (1.6 MB)
     |████████████████████████████████| 1.6 MB 120 kB/s 
Collecting ipython-genutils~=0.2.0
  Downloading ipython_genutils-0.2.0-py2.py3-none-any.whl (26 kB)
Collecting jsonschema!=2.5.0,>=2.4
  Downloading jsonschema-4.1.2-py3-none-any.whl (69 kB)
     |████████████████████████████████| 69 kB 641 kB/s 
Collecting pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0
  Downloading pyrsistent-0.18.0-cp38-cp38-manylinux1_x86_64.whl (118 kB)
     |████████████████████████████████| 118 kB 245 kB/s 
Collecting attrs>=17.4.0
  Downloading attrs-21.2.0-py2.py3-none-any.whl (53 kB)
     |████████████████████████████████| 53 kB 434 kB/s 
Collecting argon2-cffi
  Downloading argon2_cffi-21.1.0-cp35-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl (96 kB)
     |████████████████████████████████| 96 kB 560 kB/s 
Collecting Send2Trash>=1.5.0
  Downloading Send2Trash-1.8.0-py3-none-any.whl (18 kB)
Collecting terminado>=0.8.3
  Downloading terminado-0.12.1-py3-none-any.whl (15 kB)
Collecting jinja2
  Downloading Jinja2-3.0.2-py3-none-any.whl (133 kB)
     |████████████████████████████████| 133 kB 623 kB/s 
Collecting prometheus-client
  Downloading prometheus_client-0.12.0-py2.py3-none-any.whl (57 kB)
     |████████████████████████████████| 57 kB 569 kB/s 
Requirement already satisfied: cffi>=1.0.0 in ./miniconda3/lib/python3.8/site-packages (from argon2-cffi->notebook->jupyter) (1.14.6)
Requirement already satisfied: pycparser in ./miniconda3/lib/python3.8/site-packages (from cffi>=1.0.0->argon2-cffi->notebook->jupyter) (2.20)
Collecting MarkupSafe>=2.0
  Downloading MarkupSafe-2.0.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (30 kB)
Collecting pyparsing>=2.2.1
  Downloading pyparsing-3.0.4-py3-none-any.whl (96 kB)
     |████████████████████████████████| 96 kB 606 kB/s 
Collecting cycler>=0.10
  Downloading cycler-0.11.0-py3-none-any.whl (6.4 kB)
Collecting kiwisolver>=1.0.1
  Downloading kiwisolver-1.3.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.2 MB)
     |████████████████████████████████| 1.2 MB 784 kB/s 
Collecting testpath
  Downloading testpath-0.5.0-py3-none-any.whl (84 kB)
     |████████████████████████████████| 84 kB 618 kB/s 
Collecting nbclient<0.6.0,>=0.5.0
  Downloading nbclient-0.5.4-py3-none-any.whl (66 kB)
     |████████████████████████████████| 66 kB 706 kB/s 
Collecting defusedxml
  Downloading defusedxml-0.7.1-py2.py3-none-any.whl (25 kB)
Collecting mistune<2,>=0.8.1
  Downloading mistune-0.8.4-py2.py3-none-any.whl (16 kB)
Collecting bleach
  Downloading bleach-4.1.0-py2.py3-none-any.whl (157 kB)
     |████████████████████████████████| 157 kB 721 kB/s 
Collecting jupyterlab-pygments
  Downloading jupyterlab_pygments-0.1.2-py2.py3-none-any.whl (4.6 kB)
Collecting pandocfilters>=1.4.1
  Downloading pandocfilters-1.5.0-py2.py3-none-any.whl (8.7 kB)
Collecting packaging
  Downloading packaging-21.2-py3-none-any.whl (40 kB)
     |████████████████████████████████| 40 kB 848 kB/s 
Collecting webencodings
  Downloading webencodings-0.5.1-py2.py3-none-any.whl (11 kB)
Collecting pyparsing>=2.2.1
  Downloading pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
     |████████████████████████████████| 67 kB 992 kB/s 
Collecting pytz>=2017.3
  Downloading pytz-2021.3-py2.py3-none-any.whl (503 kB)
     |████████████████████████████████| 503 kB 939 kB/s 
Collecting qtpy
  Downloading QtPy-1.11.2-py2.py3-none-any.whl (58 kB)
     |████████████████████████████████| 58 kB 873 kB/s 
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./miniconda3/lib/python3.8/site-packages (from requests->d2l) (1.26.6)
Requirement already satisfied: idna<3,>=2.5 in ./miniconda3/lib/python3.8/site-packages (from requests->d2l) (2.10)
Requirement already satisfied: chardet<5,>=3.0.2 in ./miniconda3/lib/python3.8/site-packages (from requests->d2l) (4.0.0)
Requirement already satisfied: certifi>=2017.4.17 in ./miniconda3/lib/python3.8/site-packages (from requests->d2l) (2021.5.30)
Installing collected packages: traitlets, pyrsistent, attrs, wcwidth, tornado, pyzmq, python-dateutil, pyparsing, ptyprocess, parso, nest-asyncio, jupyter-core, jsonschema, ipython-genutils, entrypoints, webencodings, pygments, prompt-toolkit, pickleshare, pexpect, packaging, nbformat, matplotlib-inline, MarkupSafe, jupyter-client, jedi, decorator, backcall, testpath, pandocfilters, nbclient, mistune, jupyterlab-pygments, jinja2, ipython, defusedxml, debugpy, bleach, terminado, Send2Trash, prometheus-client, nbconvert, ipykernel, argon2-cffi, notebook, widgetsnbextension, qtpy, jupyterlab-widgets, typing-extensions, qtconsole, pytz, pillow, numpy, kiwisolver, jupyter-console, ipywidgets, cycler, torch, pandas, matplotlib, jupyter, torchvision, d2l
Successfully installed MarkupSafe-2.0.1 Send2Trash-1.8.0 argon2-cffi-21.1.0 attrs-21.2.0 backcall-0.2.0 bleach-4.1.0 cycler-0.11.0 d2l-0.17.0 debugpy-1.5.1 decorator-5.1.0 defusedxml-0.7.1 entrypoints-0.3 ipykernel-6.5.0 ipython-7.29.0 ipython-genutils-0.2.0 ipywidgets-7.6.5 jedi-0.18.0 jinja2-3.0.2 jsonschema-4.1.2 jupyter-1.0.0 jupyter-client-7.0.6 jupyter-console-6.4.0 jupyter-core-4.9.1 jupyterlab-pygments-0.1.2 jupyterlab-widgets-1.0.2 kiwisolver-1.3.2 matplotlib-3.4.3 matplotlib-inline-0.1.3 mistune-0.8.4 nbclient-0.5.4 nbconvert-6.2.0 nbformat-5.1.3 nest-asyncio-1.5.1 notebook-6.4.5 numpy-1.21.3 packaging-21.2 pandas-1.3.4 pandocfilters-1.5.0 parso-0.8.2 pexpect-4.8.0 pickleshare-0.7.5 pillow-8.4.0 prometheus-client-0.12.0 prompt-toolkit-3.0.21 ptyprocess-0.7.0 pygments-2.10.0 pyparsing-2.4.7 pyrsistent-0.18.0 python-dateutil-2.8.2 pytz-2021.3 pyzmq-22.3.0 qtconsole-5.1.1 qtpy-1.11.2 terminado-0.12.1 testpath-0.5.0 torch-1.10.0 torchvision-0.11.1 tornado-6.1 traitlets-5.1.1 typing-extensions-3.10.0.2 wcwidth-0.2.5 webencodings-0.5.1 widgetsnbextension-3.5.2

原文地址:https://www.cnblogs.com/chucklu/p/15500969.html