安装tensorflow出现问题

出现问题,检测是否安装了CUDA和CUDNN

CUDA检测方法

方法一:cat /usr/local/cuda/version.txt

方法二:nvcc -V

检测CUDNN方法:

解压版:cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

使用sudo -i dpkg安装版:cat /usr/include/cudnn.h | grep CUDNN_MAJOR -A 2

安装tensorflow出现问题_第1张图片

 

如果已安装cuda和cudnn,tensorflow安装时出现问题:

如果出现numpy问题,有提示更新pip,则按提示更新pip

更新pip后  在终端输入:pip

如果出现问题:Traceback (most recent call last): File "/usr/bin/pip", line 9, in

将 /usr/bin/pip 文件中:

from pip import  main
if __name__ == '__main__':
    sys.exit(main())

改为:

from pip import __main__
if __name__ == '__main__':
    sys.exit(__main__._main())

如果出现:ERROR: markdown 3.1.1 has requirement setuptools>=36, but you'll have setuptools 20.7.0 which is incompatible.

说明版本太低,需要更高版本,更新就好啦

解决方法:pip install --upgrade setuptools

 

如果遇到:ERROR: Cannot uninstall 'enum34'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

解决方法:sudo pip install enum34 --ignore-installed enum34

测试tensorflow是否安装好:

终端输入:python

 

import tensorflow as tf

hello = tf.constant('Hello, TensorFlow!')

sess = tf.Session()

print(sess.run(hello))

 

输出出现:

安装tensorflow出现问题_第2张图片

恭喜你,搞定了!欢迎使用tensorflow

你可能感兴趣的:(Tensorflow环境)