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的描述符(descriptor)、装饰器(property)造成的一个无限递归问题分享
Jul 09 Python
在Python下使用Txt2Html实现网页过滤代理的教程
Apr 11 Python
Python图片裁剪实例代码(如头像裁剪)
Jun 21 Python
Python自动化开发学习之三级菜单制作
Jul 14 Python
Python字典数据对象拆分的简单实现方法
Dec 05 Python
Python实现JSON反序列化类对象的示例
Jan 31 Python
Python3调用百度AI识别图片中的文字功能示例【测试可用】
Mar 13 Python
在django中自定义字段Field详解
Dec 03 Python
Pycharm中import torch报错的快速解决方法
Mar 05 Python
selenium WebDriverWait类等待机制的实现
Mar 18 Python
Python Django框架介绍之模板标签及模板的继承
May 27 Python
python3+PyQt5+Qt Designer实现界面可视化
Jun 10 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制作新闻系统的思路
2006/10/09 PHP
PHP扩展CURL的用法详解
2014/06/20 PHP
ThinkPHP单字母函数(快捷方法)使用总结
2014/07/23 PHP
php+ajax实现带进度条的上传图片功能【附demo源码下载】
2016/09/14 PHP
php实现将数据做成json的格式给前端使用
2018/08/21 PHP
PHP的PDO连接讲解
2019/01/24 PHP
网站页面自动跳转实现方法PHP、JSP(下)
2010/08/01 Javascript
一个简单的JS鼠标悬停特效具体方法
2013/06/17 Javascript
JavaScript中字面量与函数的基本使用知识
2015/10/20 Javascript
js删除局部变量的实现方法
2016/06/25 Javascript
javascript动画之模拟拖拽效果篇
2016/09/26 Javascript
微信小程序 图片边框解决方法
2017/01/16 Javascript
Bootstrap组合上、下拉框简单实现代码
2017/03/06 Javascript
浅谈mint-ui loadmore组件注意的问题
2017/11/08 Javascript
jQuery实现新闻播报滚动及淡入淡出效果示例
2018/03/23 jQuery
解决vue项目中type=”file“ change事件只执行一次的问题
2018/05/16 Javascript
Phaser.js实现简单的跑酷游戏附源码下载
2018/10/26 Javascript
Node.js开发之套接字(socket)编程入门示例
2019/11/05 Javascript
[01:31:02]TNC vs VG 2019国际邀请赛淘汰赛 胜者组赛BO3 第一场
2019/08/22 DOTA
归纳整理Python中的控制流语句的知识点
2015/04/14 Python
Python cx_freeze打包工具处理问题思路及解决办法
2016/02/13 Python
Python中字符串的处理技巧分享
2016/09/17 Python
django2.0扩展用户字段示例
2019/02/13 Python
使用 Supervisor 监控 Python3 进程方式
2019/12/05 Python
PyTorch预训练Bert模型的示例
2020/11/17 Python
html5 canvas fillRect坐标和大小的问题解决方法
2014/03/26 HTML / CSS
英国领先的野生鸟类食品供应商:GardenBird
2018/08/09 全球购物
教师自荐书
2013/10/08 职场文书
财会自我鉴定范文
2013/12/27 职场文书
超市后勤自我鉴定
2014/01/17 职场文书
小学教师听课制度
2014/02/01 职场文书
上课迟到检讨书范文
2015/05/06 职场文书
优秀乡村医生事迹材料(2016精选版)
2016/02/29 职场文书
php 原生分页
2021/04/01 PHP
CSS3实现指纹特效代码
2022/03/17 HTML / CSS
SQL中的连接查询详解
2022/06/21 SQL Server