新安裝完 tensorflow 後import tensorflow as tf 報錯

>>> import tensorflow as tfpython

/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`.linux

  from ._conv import register_converters as _register_convertersweb

h5py 和 numpy 1.14.2版本衝突,h5py 官方已修復合併到 master 分支,可是還沒發新版,在發版以前能夠用降級 numpy 的方法跳過這個問題。降級命令以下:app

[root@worker08 bin]# ./pip install numpy==1.13.3ide

Collecting numpy==1.13.3spa

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

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

Installing collected packages: numpyit

  Found existing installation: numpy 1.14.0pip

    Uninstalling numpy-1.14.0:

      Successfully uninstalled numpy-1.14.0

Successfully installed numpy-1.13.3


[root@worker08 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

>>> 


有的主機在下降numpy版本爲1.13.3的時候在import tensorflow as tf 會報模塊不支持的錯誤,我擦!~ 我03機器就是這樣,因此還必須得升回1.14版本,

但問題仍是那個問題,換個思路就是升級 h5py

[root@worker03 bin]./pip install h5py==2.8.0rc1

[root@worker03 bin]# python3.6

Python 3.6.3 |Anaconda custom (64-bit)| (default, Feb 12 2018, 06:37:09) 

[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux

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

Intel(R) Distribution for Python is brought to you by Intel Corporation.

Please check out: https://software.intel.com/en-us/python-distribution

>>> import tensorflow as tf 

>>> 

相關文章
相關標籤/搜索