Warning对应Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated

现象

import tensorflow 的时候提示如下信息
/anaconda2/lib/python2.7/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

原因

原因已经提示在Warning信息中了,升级h5py即可,其实这个问题,在单独import h5py的时候也会直接碰到

liumiaocn:Notebook liumiao$ python
Python 2.7.15 |Anaconda, Inc.| (default, May  1 2018, 18:37:05) 
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import h5py
/anaconda2/lib/python2.7/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: h5py是对HDF5文件格式提供读写功能的py的package。

对应

确认当前h5py版本

liumiaocn:Notebook liumiao$ pip show h5py
Name: h5py
Version: 2.7.1
Summary: Read and write HDF5 files from Python
Home-page: http://www.h5py.org
Author: Andrew Collette
Author-email: [email protected]
License: UNKNOWN
Location: /anaconda2/lib/python2.7/site-packages
Requires: numpy, six
Required-by: 
liumiaocn:Notebook liumiao$ 

确认最新版本

使用pip search确认最新版本

liumiaocn:Notebook liumiao$ pip search h5py
h5py-cache (1.0.1)    - Create h5py File object with specified cache
h5py (2.8.0)          - Read and write HDF5 files from Python
  INSTALLED: 2.7.1
  LATEST:    2.8.0
h5py-wrapper (1.1.0)  - A wrapper to conveniently store nested Python dictionaries in hdf5 files.
h5netcdf (0.6.2)      - netCDF4 via h5py
HDF5pp (0.1.4)        - Wrapper around h5py
hdfdict (0.1.1alpha)  - Helps h5py to load and dump dictionaries containg types supported by h5py.
nested_h5py (0.0.3)   - Pandas reader and writer from h5py
h5pickle (0.3)        - Wrap h5py objects to allow pickling
h5pom (0.1)           - An ORM for hdf5 using h5py for basic IO
h5preserve (0.16.1)   - Thin wrapper around h5py, inspired by camel
LazyHDF5 (0.2.0)      - Python Macros for h5py... because I'm lazy
h5pyd (0.3.2)         - h5py compatible client lib for HDF REST API
liumiaocn:Notebook liumiao$

如果是使用Anaconda,可以使用conda进行确认

liumiaocn:Notebook liumiao$ conda search h5py
Loading channels: done
# Name                  Version           Build  Channel             
h5py                      2.0.1      np15py26_0  pkgs/free           
...省略              
h5py                      2.8.0  py37h878fce3_3  pkgs/main           
h5py                      2.8.0  py37h967a92a_0  pkgs/main           
liumiaocn:Notebook liumiao$

安装新版

可以使用pip install h5py,根据需要可以指定版本进行确认。也可以使用conda install 进行安装。这里使用conda进行更新

liumiaocn:Notebook liumiao$ conda install h5py
Solving environment: done

## Package Plan ##

  environment location: /anaconda2

  added / updated specs: 
    - h5py


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    unittest2-1.1.0            |           py27_0         143 KB
    traceback2-1.4.0           |           py27_0          31 KB
    linecache2-1.0.0           |           py27_0          24 KB
    h5py-2.8.0                 |   py27h878fce3_3         895 KB
    ------------------------------------------------------------
                                           Total:         1.1 MB

The following NEW packages will be INSTALLED:

    linecache2: 1.0.0-py27_0        
    traceback2: 1.4.0-py27_0        
    unittest2:  1.1.0-py27_0        

The following packages will be UPDATED:

    h5py:       2.7.1-py27ha8ecd60_2 --> 2.8.0-py27h878fce3_3

Proceed ([y]/n)? y


Downloading and Extracting Packages
unittest2-1.1.0      | 143 KB    | ############################################################################################# | 100% 
traceback2-1.4.0     | 31 KB     | ############################################################################################# | 100% 
linecache2-1.0.0     | 24 KB     | ############################################################################################# | 100% 
h5py-2.8.0           | 895 KB    | ############################################################################################# | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
liumiaocn:Notebook liumiao$ 

安装后确认

确认h5py版本已经更新到2.8.0

liumiaocn:Notebook liumiao$ pip show h5py
Name: h5py
Version: 2.8.0
Summary: Read and write HDF5 files from Python
Home-page: http://www.h5py.org
Author: Andrew Collette
Author-email: [email protected]
License: BSD
Location: /anaconda2/lib/python2.7/site-packages
Requires: numpy, six
Required-by: 
liumiaocn:Notebook liumiao$

包import确认:h5py

liumiaocn:Notebook liumiao$ python
Python 2.7.15 |Anaconda, Inc.| (default, May  1 2018, 18:37:05) 
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import h5py
>>> 

包import确认:tensorflow

liumiaocn:Notebook liumiao$ python
Python 2.7.15 |Anaconda, Inc.| (default, May  1 2018, 18:37:05) 
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
>>> 

你可能感兴趣的:(人工智能,TensorFlow入门教程)