1. 创建制定python版本的环境
在anaconda新建虚拟环境,python版本选3.6(安装1.x版本Tensorflow-gpu)
conda create --name your_env_name python=2.7
conda create --name your_env_name python=3
conda create --name your_env_name python=3.5
2. 切换源
查看源:conda config --show-sources
清华源:
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 --set show_channel_urls yes
3. torch/tensorflow安装
(1)torch和cuda版本对应
https://pytorch.org/get-started/previous-versions/
(2)tensorflow安装
tensorflow版本对应查询:
https://tensorflow.google.cn/install/source_windows#install_gpu_support_optional
进入新建环境安装cudnn和cudatoolkit(换成清华源,Ubuntu去换成linux-64应该就可以
conda install cudnn=7.3.1 -c
https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/
conda install cudatoolkit=9.0 -c
https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/
安装指定版本tensorflow,如果速度慢网上查换成豆瓣源或清华源
pip install tensorflow-gpu==1.12
pip install tensorflow==1.2.0 -i https://pypi.douban.com/simple
4.安装完输入conda list
查询是否安装对应版本,去网上找测试ensorflow-gpu代码测试即可.
- https://mirrors.ustc.edu.cn/anaconda/cloud/
- https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
- https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
- https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/
- https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/
- https://mirrors.ustc.edu.cn/anaconda/cloud/peterjc123/
- https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
- https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
- https://mirrors.ustc.edu.cn/anaconda/cloud/pytorch/
- https://mirrors.ustc.edu.cn/anaconda/pkgs/r/