查看算力 : https://developer.nvidia.com/cuda-gpus 检查版本驱动不得低于410: 进入cmd中输入命令 nvidia-msi 驱动程序不够的话网址自己下载: https://www.nvidia.com/Download/index.aspx?lang=en-us
tensorflow-GPU要求: CUDA的版本需要是10.0 cudnn版本号需要不小于7.4.1 (不用自己安装,使用之后的命令conda会给你自动安装)
安装VC++(前提条件) https://support.microsoft.com/zh-cn/help/2977003/the-latest-supported-visual-c-downloads 安装后会重启电脑,请提前做好准备
我的电脑是64位,选第二个
无anaconda: 官方网站: https://www.anaconda.com/products/individual#macos 如果想速度下载的话,用清华源下载: https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ 拉到最后下载最新的,一般都是windows,则采用:
有anaconda: 更新anaconda版本 conda update conda conda updata anaconda
设置清华源 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --set show_channel_urls yes 如果清华源设置失败 可找到C盘—>users—>.condarc 删除default即可
conda install tensorflow-gpu==X.X.X (一行命令 版本自己选择)
第六步: 进入anaconda prompt 输入:python 然后输入:
import tensorflow as tf tf.__version__(注意是双下划线) tf.test.is_gpu_available如果为True,则证明安装成功!
如果要使用CPU版,使用此行代码即可 后面的豆瓣为了加速,跟清华源作用相同: pip install tensorflow-cpu ==2.2.0 -i https://pypi.douban.com/simple/ 请注意 跟conda一样一定要升级!!安装CPU版的pip也要升级,不然版本安装不了最新的: python -m pip install --upgrade pip