虚拟环境安装gpu版Tensorflow、Pytorch

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/
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值