去除警告: FutureWarning: Conversion of the second argumecated. In future, it will be treated as `np.float64 == np.dtype float.type`.(20190128)

文章目录:

  • 一、警告原因分析
  • 二、解决方法

最近在使用tensorflow-gpu的时候总是报警告,就我这强迫症能够忍他吗,no!绝对不能忍!!!
我的环境:

  • cudnn=7.0
  • cuda=9.0
  • tensorflow-gpu=1.8 或 1.9 或 1.10.0 或 1.11.0

在上面的这个环境配置下都会报这个警告,解决方式都是一样的


一、警告原因分析

从下面包的警告可以看出,是和h5py这个库包有关的

>>> import tensorflow as tf
/home/mosheng/miniconda3/envs/swap_back/lib/python3.5/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the secoecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.from ._conv import register_converters as _register_converters
>>> tf.__path__
['/home/mosheng/miniconda3/envs/swap_back/lib/python3.5/site-packages/tensorflow']
>>> exit()

于是查看一下自己本机目前安装的h5py的版本,是h5py=2.7.1

(swap) mosheng@server:~/miniconda3/envs/swap/lib$ conda list h5py
# packages in environment at /home/mosheng/miniconda3/envs/swap:
#
# Name                    Version                   Build  Channel
h5py                      2.7.1                     <pip>

如果你导入keras也会报同样的错误,因为keras是以tensorflow为后端的。

>>> import keras
/home/mosheng/miniconda3/envs/swap/lib/python3.5/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second ard. In future, it will be treated as `np.float64 == np.dtype(float).type`.from ._conv import register_converters as _register_converters
Using TensorFlow backend.

二、解决方法

这个问题是由于h5py的版本造成的,升级一下h5py的版本即可解决
(我是从2.7.1升级到2.8.0版本,成功去除警告)

 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple h5py==2.8.0

注意:

可能会有些人升级是用:pip install h5py==2.8.0rc1
我试了,这种方法会出现找不到该版本,如若出现上面情况,请去掉版本号后面的rc1即可。

(swap) mosheng@server:~/miniconda3/envs/swap/lib$ pip install -i https://pypi.tuna.tsinghua.e                             du.cn/simple h5py==2.8.0rc1
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting h5py==2.8.0rc1Could not find a version that satisfies the requirement h5py==2.8.0rc1 (from versions: 2.2.                                 1, 2.3.0, 2.3.1, 2.4.0, 2.5.0, 2.6.0, 2.7.0, 2.7.1, 2.8.0, 2.9.0)
No matching distribution found for h5py==2.8.0rc1

下面再导入tensorflow 或 keras就不会出现警告啦

>>> import keras
Using TensorFlow backend.
>>> import tensorflow as tf
>>>

Reference:
1、https://github.com/h5py/h5py/issues/961
2、https://stackoverflow.com/questions/48340392/futurewarning-conversion-of-the-second-argument-of-issubdtype-from-float-to




♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠

去除警告: FutureWarning: In future, it will be treated as `np.float64 == np.dtype(float).type`.相关推荐

  1. 去除警告,打电话,发信息,应用程序之间跳转,打印沙盒路径,字符串名字转换方法,包装导航控制器等的代码...

    从偏好设置中读取值: 打电话代码: 发信息代码: 打印沙盒路径代码: 应用程序之间跳转代码: 跳转到苹果商店代码: 去除警告代码: 根据字符串名称转换成相对应方法的代码: #import " ...

  2. 去除警告:Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA

    去除警告:Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 文章 ...

  3. Intellij IDEA 去除警告波浪线(Weak Warning)

    Intellij IDEA 去除警告波浪线 流程 File→ Settings→ Editor→ Color Scheme→ General → Errors and Warnings→ Weak W ...

  4. spire.pdf转换word去除警告

    目前只用两个版本的去除方式 第一种是4.1.2版本的 这个版本的去除比较好去,去除第一个元素即可 代码如下: 第二种是5.2.3版本的 这个版本的警告不在第一个元素了,亲测,想了一下办法应该能够去除大 ...

  5. iOS 去除警告 看我就够了

    你是不是看着开发过程中出现的一堆的警告会心情一阵烦躁,别烦躁了,看完此文章,消除警告的小尾巴. 一.SVN 操作导致的警告 1.svn删除文件后报错 "xx"is missing ...

  6. 去除警告 ArrayList is a raw type

    Eclipse里出现的警告: ArrayList is a raw type. References to generic type ArrayList should be parameterized ...

  7. Rider去除警告波浪线设置

    点击下面出现颜色   选择去除绿色和黄色标志 发现还有下划线: 可以通过showxxx =>Do no show

  8. java 去除警告_Java——警告消除

    @SuppressWarnings("unchecked")解释 解释一: 屏蔽某些编译时的警告信息 在强制类型转换的时候编译器会给出警告 加上 程序代码 @SuppressWar ...

  9. PHPSTORM去除警告波浪线的方法

    方法:File-Setting-Editor-Color Scheme-General-Errors and Warnings 进入上述说的步骤之后,找到Weak Warnings取消Error st ...

最新文章

  1. 实现对学生信息的增加操作
  2. 笔记本独显无输出_高价位笔记本电脑推荐(一万一以上)
  3. 快速幂(二进制,十进制)
  4. ModelCheckpoint 讲解【TensorFlow2入门手册】
  5. 【Python】用Pyecharts制作炫酷的可视化大屏
  6. e几个灯同时亮灭两次verilog_FPGA题及答案
  7. 减小TabLayout高度而不影响每个tab展示的几种方法
  8. Android studio使用git切换分支开发的方法(图文教程)
  9. 单片机小白学步系列(三) 偶遇51单片机
  10. Vue2.x总结(1)
  11. java 栈的用法_让Java程序员再次生机勃勃,还是技术的力量
  12. 通过jQuery.support看javascript中的兼容性问题
  13. 黑群晖XPEnoboot for DSM 5.2-5967.1
  14. C语言 数据结构 线性循环队列 基本操作代码
  15. pvq真值表_逻辑学真值表
  16. VIVADO软件介绍与使用
  17. 霍学文:大数据重塑未来金融监管方式
  18. (二)基于区块链的自动抽奖系统从0到1实现
  19. 从程序员到项目经理(六):懂电脑更要懂人脑
  20. ivms虚拟服务器,ivms监控服务器地址

热门文章

  1. 通过浏览器下载服务端图片到客户端
  2. ReactNative-----环境搭建二(android)
  3. alertdialog.builder 自定义弹窗
  4. linux shell 脚本实现tcp/upd协议通讯(重定向应用)
  5. python进阶书籍的推荐 知乎-推荐几本Python3相关书籍?最好分一下基础、进阶、高级...
  6. python新手入门讲解-这是大多数新手入门之后强烈推荐的python自学入门指南秘笈...
  7. python怎么读取excel某一行某一列-python3读取excel文件只提取某些行某些列的值方法...
  8. python可以自学吗需要什么基础-python自学行吗?给编程初学者零基础入门的建议...
  9. 基于python的界面自动化测试-Python实现性能自动化测试竟然如此简单
  10. python画折线图代码-python编程:如何使用python代码绘制折线图?