更新pip : python -m pip install --upgrade pip
1.使用清华源加速(安装速度快)
-i https://pypi.tuna.tsinghua.edu.cn/simple
mkdir ~/.pip
vim ~/.pip/pip.conf
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com
2.装anaconda (管理建立虚拟环境)
我们可以按照需要装 python3.5 ,或者python3.6 .
为了保证这些python环境不冲突,我们通过anaconda建立多个虚拟环境来管理。
anaconda管理建立多个虚拟环境
https://www.anaconda.com/download/
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.2.0-Linux-x86_64.sh
$ bash Anaconda3-5.2.0-Linux-x86_64.sh
关于 conda 找不到:
- 如果默认配置路径需要输入 source ~/.bashrc
- 如果没有默认添加路径
vim ~/.bashrc
export PATH="/home/guanyun/anaconda3/bin:$PATH"
保存退出(ESC 然后 :wq) 如果没有编辑直接退出 :q
3.建立你所需python版本的虚拟环境
pip install --upgrade http://download.tensorflow.google.cn/linux/gpu/tensorflow_gpu-1.8.0-cp36-cp36m-linux_x86_64.whl
4.在虚拟环境下装 pytorch
Anaconda 镜像使用帮助
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes