安装TensorFlow2.1GPU版本

打开anaconda prompt

在这里插入图片描述

新建一个名叫TF2.1的虚拟环境

//用python3.7版本
conda create -n TF2.1 python=3.7

在这里插入图片描述

进入刚刚所创建的TF2.1虚拟环境

conda activate TF2.1

在这里插入图片描述

安装英伟达的SDK 10.1版本

conda install cudatoolkit=10.1

在这里插入图片描述

安装英伟达深度学习软件包7.6版本

conda install cudnn=7.6

在这里插入图片描述

安装TensorFlow-gpu=2.1

pip install tensorflow-gpu==2.1
# 或者
conda install tensorflow-gpu==2.1

在这里插入图片描述

检查是否安装成功

在这里插入图片描述

// 在TF2.1虚拟环境输入python
python

// 导入tensorflow模块
import tensorflow as tf

// 查看tensorflow版本---2.1.0
tf.__version__

// 查看tensorflow-gpu能否运行
tf.test.is_gpu_available()

注意事项

我在安装condatooklit和cudnn时,一直显示闪退,出现如下问题
在这里插入图片描述
后来我将C盘/用户/(你的用户名)xx/.condarc 这个文件给删掉就能安装了
在这里插入图片描述

condarc文件里面是清华源的路径,具体如下

channels:
  - defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

下一篇文章是在pycharm中导入TF2.1虚拟环境
点击链接: 转到下一篇文章.

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值