安装miniconda
- 新建文件夹
mkdir download - 进入目录
cd download/ - 下载miniconda安装包
wget -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-x86_64.sh
- 使用安装包
sh Miniconda3-latest-Linux-x86_64.sh
(连续输入yes)
如果出现
添加环境变量
export PATH=~/miniconda3/bin:$PATH
source ~/.bashrc - 添加源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
# for legacy win-64
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/peterjc123/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels
conda config --set show_channel_urls yes
–清除源
conda config --remove-key channels
设置搜索时显示通道地址
conda config --set show_channel_urls yes
- 创建名为py36的虚拟环境
conda create -n py36 python=3.6
conda activate py36 (加入 ~/.bashrc 默认激活该环境)
查看CUDA CUDNN 版本
cat /usr/local/cuda/version.txt
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
版本为:
cuda 9.0.176
cudnn 7.0.5
确定合适的TensorFlow和PyTorch版本
- TensorFlow
https://tensorflow.google.cn/install/source#linux
例如我的环境可以安装tf 1.11.0 (GPU)
conda install tensorflow-gpu==1.11.0
- PyTorch
https://pytorch.org/
https://pytorch.org/get-started/previous-versions/
例如我的环境可以安装 pytorch 1.1.0 (GPU)conda install pytorch==1.1.0 torchvision==0.3.0 # 不用加 -c 为用国内源
查看版本号检查是否安装成功
- TensorFlow
- PyTorch