能安装GPU的前提是: 1、显卡支持CUDA (1)右击我的电脑–属性 (2)打开设备管理器 (3)显示适配器 我的电脑是支持CUDA的
2、pip 版本 >= 8.1 查看pip版本 :pip -V 更新pip : python -m pip install -U pip
安装anaconda,这个在之前的博客里已经详细介绍过 (https://blog.csdn.net/qq_39295665/article/details/88206251)
(1)进入官网,https://developer.nvidia.com/cuda-toolkit-archive 下载对应版本的cuda,这里下载的是8.0版本 (2)点开安装包后,选择路径存放 (3)开始解压 (4)测试兼容性 (5)安装协议 (6)自定义选择安装位置 安装CUDA相关项 (8)安装结束 (9)测试
在命令行输入nvcc -V
(1)进入官网选择相对应版本下载 https://developer.nvidia.com/cudnn 选择download (2)进行注册 (3)选择相对应版本 (4)进行解压 将解压后的这个.dll文件复制到CUDA文件夹下的对应地址
(1)我的python版本是3.7,3.7版本的python不支持pip安装tensorflow 因,此需要在系统的环境变量中加入两条路径 第2和3需要自己手动添加
(2)使用语句pip3 install --upgrade tensorflow-gpu安装
(3)测试 在命令行中,进入python,并输入以下代码:
import tensorflow as tf hello = tf.constant('Hello, TensorFlow!') sess = tf.Session() print(sess.run(hello))查看tensorflow版本
1、importerror: Something is wrong with the numpy installation. While importing we detected an older version of numpy in [‘C:\Users\WeiLinLin\Anaconda3\envs\tensorflow\Lib\site-packages\numpy’]. One method of fixing this is to repeatedly uninstall numpy until none is found, then reinstall this version.
出现这个报错说明在安装新的软件,或者更新numpy时,旧的numpy没有卸载掉,两版numpy导致出现冲突。
解决: (1)卸载numpy :pip uninstall numpy (2)再卸载numpy,直到卸载到提示信息,此时完全已经没有numpy了为止,提示了Skipping numpy as it is not installed. (3)安装numpy : pip install numpy
2、Tensorflow导入报"Failed to load the native TensorFlow runtime."
解决: 更新TensorFlow : pip install --upgrade --ignore-installed tensorflow