安装tensorflow遇到的问题以及解决方案

通过pip安装tensorflow1.8.0-gpu

# 百度了挺久,汇总一下我碰到的问题以及解决方法

特别需要的就是注意版本号的对应,之前几次尝试安装没有成功都是因为版本没有对应好

tensorflow的安装

pip install tensorflow-gpu -i https://pypi.tuna.tsinghua.edu.cn/simple

清华镜像源安装会快很多

运行支持 GPU 的 TensorFlow 所需满足的要求
tensorflow官方安装说明

报错1

Could not find ‘cudart64_90.dll

我尝试了安装cuda9.0

报错2

Could not find ‘cudnn64_7.dll’
查阅之后
需要安装cuDNN 7
传到了网盘链接:https://pan.baidu.com/s/1GJ1x0UkyVnGGEwMkiLgJrQ 密码:wct1
cudnn安装方法

第五步没有做,没有用vs ,用了pycharm,暂时没有发现问题。

测试结果

#输入#
import tensorflow

hello = tensorflow.constant("Hello!Tensorflow")
sess = tensorflow.Session()

print(sess.run(hello))
#结果#
2018-06-11 23:16:29.230768: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1356] Found device 0 with properties: 
name: GeForce GTX 1060 6GB major: 6 minor: 1 memoryClockRate(GHz): 1.7845
pciBusID: 0000:01:00.0
totalMemory: 6.00GiB freeMemory: 4.96GiB
2018-06-11 23:16:29.231216: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1435] Adding visible gpu devices: 0
2018-06-11 23:16:30.006880: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-06-11 23:16:30.007124: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:929]      0 
2018-06-11 23:16:30.007279: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:942] 0:   N 
2018-06-11 23:16:30.007558: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4732 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1060 6GB, pci bus id: 0000:01:00.0, compute capability: 6.1)
b'Hello!Tensorflow'

参考:

Windows下安装tensorflow GPU版本报错:OSError: [WinError 126] 找不到指定的模块/Could not find ‘cudart64_90.dll’.

(Tensorflow-GPU) import tensorflow ImportError: Could not find ‘cudnn64_7.dll’

cuDNN Installation Guide

最正确的姿势安装cudnn,网上大多数教程都太坑了

终于这块显卡除了吃鸡还可以别的用处了

猜你喜欢

转载自blog.csdn.net/qq_32674197/article/details/80659327
今日推荐