tensorflow与numpy的版本兼容性问题的解决


Posted in Python onJanuary 08, 2021

在Python交互式窗口导入tensorflow出现了下面的错误:

root@ubuntu:~# python3 
Python 3.6.8 (default, Oct 7 2019, 12:59:55) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf;
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 np_resource = np.dtype([("resource", np.ubyte, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 np_resource = np.dtype([("resource", np.ubyte, 1)])

我的错误原因是numpy的版本较高造成的,换成1.14.0版本后解决了

出错时的Numpy版本

root@ubuntu:~# pip3 show numpy
Name: numpy
Version: 1.17.3
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: None
License: BSD
Location: /usr/local/lib/python3.6/dist-packages
Requires:

安装1.14.0的Numpy版本

root@ubuntu:~# pip3 install numpy==1.14.0
Collecting numpy==1.14.0
 Downloading https://files.pythonhosted.org/packages/dc/ac/5c270dffb864f23315e9c1f9e0a0b300c797b3c170666c031c4de42aacae/numpy-1.14.0-cp36-cp36m-manylinux1_x86_64.whl (17.2MB)
  100% |????????????????????????????????| 17.2MB 75kB/s 
Installing collected packages: numpy
Successfully installed numpy-1.14.0
root@ubuntu:~# python3
Python 3.6.8 (default, Oct 7 2019, 12:59:55) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf;
>>> tf.__version__
'1.14.0'
>>>

到此这篇关于tensorflow与numpy的版本兼容性问题的解决的文章就介绍到这了,更多相关tensorflow与numpy版本兼容性内容请搜索三水点靠木以前的文章或继续浏览下面的相关文章希望大家以后多多支持三水点靠木!

Python 相关文章推荐
Python实现把回车符\r\n转换成\n
Apr 23 Python
Python编写生成验证码的脚本的教程
May 04 Python
Android基于TCP和URL协议的网络编程示例【附demo源码下载】
Jan 23 Python
Python实现字符串的逆序 C++字符串逆序算法
May 28 Python
Python简单读写Xls格式文档的方法示例
Aug 17 Python
啥是佩奇?使用Python自动绘画小猪佩奇的代码实例
Feb 20 Python
详解Python Qt的窗体开发的基本操作
Jul 14 Python
python同步两个文件夹下的内容
Aug 29 Python
python中web框架的自定义创建
Sep 08 Python
python中with语句结合上下文管理器操作详解
Dec 19 Python
浅谈Selenium 控制浏览器的常用方法
Dec 04 Python
python基础之函数的定义和调用
Oct 24 Python
matplotlib自定义鼠标光标坐标格式的实现
Jan 08 #Python
selenium设置浏览器为headless无头模式(Chrome和Firefox)
Jan 08 #Python
python画图时设置分辨率和画布大小的实现(plt.figure())
Jan 08 #Python
python使用matplotlib的savefig保存时图片保存不完整的问题
Jan 08 #Python
Numpy中的数组搜索中np.where方法详细介绍
Jan 08 #Python
python 窃取摄像头照片的实现示例
Jan 08 #Python
详解python使用金山词霸的翻译功能(调试工具断点的使用)
Jan 07 #Python
You might like
PHP网页游戏学习之Xnova(ogame)源码解读(四)
2014/06/23 PHP
PHP中__autoload和Smarty冲突的简单解决方法
2016/04/08 PHP
php实现的XML操作(读取)封装类完整实例
2017/02/23 PHP
Yii框架实现多数据库配置和操作的方法
2017/05/25 PHP
php实现基于pdo的事务处理方法示例
2017/07/21 PHP
[原创]PHP正则匹配中英文、数字及下划线的方法【用户名验证】
2017/08/01 PHP
jQuery的DOM操作之删除节点示例
2014/01/03 Javascript
js判断浏览器是否支持html5
2014/08/17 Javascript
AngularJS入门知识之MVW类框架的编程思想探讨
2014/12/08 Javascript
js识别uc浏览器的代码
2015/11/06 Javascript
微信公众号开发 实现点击返回按钮就返回到聊天界面
2016/12/15 Javascript
jQuery使用eraser.js插件实现擦除、刮刮卡效果的方法【附eraser.js下载】
2017/04/28 jQuery
Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#‘的解决方法
2017/06/17 Javascript
5分钟打造简易高效的webpack常用配置
2017/07/04 Javascript
Thinkphp5微信小程序获取用户信息接口的实例详解
2017/09/26 Javascript
jQuery实现checkbox即点即改批量删除及中间遇到的坑
2017/11/11 jQuery
Vue中render函数的使用方法
2018/01/31 Javascript
jQuery实现的监听导航滚动置顶状态功能示例
2018/07/23 jQuery
Node.js JSON模块用法实例分析
2019/01/04 Javascript
layui form.render('select', 'test2') 更新渲染的方法
2019/09/27 Javascript
详解vue路由
2020/08/05 Javascript
[01:32:50]DOTA2-DPC中国联赛 正赛 DLG vs XG BO3 第一场 1月25日
2021/03/11 DOTA
python获得图片base64编码示例
2014/01/16 Python
Python学习笔记之常用函数及说明
2014/05/23 Python
Python检测QQ在线状态的方法
2015/05/09 Python
python3编码问题汇总
2016/09/06 Python
Python实现字典的遍历与排序功能示例
2017/12/23 Python
pyqt5移动鼠标显示坐标的方法
2019/06/21 Python
Python使用Slider组件实现调整曲线参数功能示例
2019/09/06 Python
Pytorch之Variable的用法
2019/12/31 Python
使用CSS媒体查询(Media Queries)和JavaScript判断浏览器设备类型的方法
2014/04/03 HTML / CSS
加拿大女鞋品牌:ALDO
2016/11/13 全球购物
Invicta手表官方商店:百年制表历史的瑞士腕表品牌
2019/09/26 全球购物
物流管理专业自荐信
2014/06/23 职场文书
百年校庆宣传标语口号
2015/12/26 职场文书
如何书写你的职业生涯规划书?
2019/06/27 职场文书