Docker 环境搭建
1、 先更新apt-get
sudo apt-get update
sudo apt-get upgrade
2、更新apt-get的下载源
sudo vim /etc/apt/sources.list
修改sources.list的内容为下面的设置
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
若是LTS 18.04 则需将xenial
换成bionic
3、 再更新一下apt-get
sudo apt-get update
sudo apt-get upgrade
4、 安装python3
sudo apt-get install python3
5、安装pip3
sudo apt-get install python3-pip
sudo pip3 install --upgrade pip
如果遇到问题,请参考problem
6、更新pip3的下载源
mkdir ~/.pip
cd ~/.pip/
vim pip.conf
修改pip.conf的内容为下面的设置
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
7、安装一些常用的包
pip3 install numpy scipy pandas matplotlib sklearn opencv-python tqdm
8、安装pytorch
pip3 install torch torchvision
这里看网速,网速慢建议先去官网下载好了,然后在本地进行安装