新安装完 tensorflow 后import tensorflow as tf 报错

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了新安装完 tensorflow 后import tensorflow as tf 报错相关的知识,希望对你有一定的参考价值。

>>> import tensorflow as tf

/opt/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.

  from ._conv import register_converters as _register_converters

h5py 和 numpy 1.14.2版本冲突,h5py 官方已修复合并到 master 分支,但是还没发新版,在发版之前可以用降级 numpy 的方法跳过这个问题。降级命令如下:

[[email protected] bin]# ./pip install numpy==1.13.3

Collecting numpy==1.13.3

  Downloading https://files.pythonhosted.org/packages/57/a7/e3e6bd9d595125e1abbe162e323fd2d06f6f6683185294b79cd2cdb190d5/numpy-1.13.3-cp36-cp36m-manylinux1_x86_64.whl (17.0MB)

    100% |████████████████████████████████| 17.0MB 1.7MB/s 

Installing collected packages: numpy

  Found existing installation: numpy 1.14.0

    Uninstalling numpy-1.14.0:

      Successfully uninstalled numpy-1.14.0

Successfully installed numpy-1.13.3


[[email protected] bin]# python3.6

Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19) 

[GCC 7.2.0] on linux

Type "help", "copyright", "credits" or "license" for more information.

>>> import tensorflow as tf

>>> 


以上是关于新安装完 tensorflow 后import tensorflow as tf 报错的主要内容,如果未能解决你的问题,请参考以下文章

pip 和pip3的区别

2.Linux虚拟机新安装debian11后常用命令

Python:pip 和pip3的区别

ubuntu下用anaconda3安装Tensorflow

为啥ubuntu12.04装完 qt 后桌面上啥都没有了,就剩下个桌面背景?

Linux虚拟机里面安装VMware Tools增强工具