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遍历某目录下的所有文件夹与文件路径
Mar 15 Python
Python反射和内置方法重写操作详解
Aug 27 Python
Python实现根据日期获取当天凌晨时间戳的方法示例
Apr 09 Python
Python socket模块实现的udp通信功能示例
Apr 10 Python
python使用pandas处理大数据节省内存技巧(推荐)
May 05 Python
Python下应用opencv 实现人脸检测功能
Oct 24 Python
Django实现网页分页功能
Oct 31 Python
python实现超市商品销售管理系统
Nov 22 Python
python统计函数库scipy.stats的用法解析
Feb 25 Python
Python matplotlib绘制图形实例(包括点,曲线,注释和箭头)
Apr 17 Python
python爬虫实例之获取动漫截图
May 31 Python
python boto和boto3操作bucket的示例
Oct 30 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定时删除文件夹下文件(清理缓存文件)
2013/01/23 PHP
PHP实现添加购物车功能
2017/03/06 PHP
javascript div 弹出可拖动窗口
2009/02/26 Javascript
JavaScript 获取当前时间戳的代码
2010/08/05 Javascript
JS完整获取IE浏览器信息包括类型、版本、语言等等
2014/05/22 Javascript
js中函数声明与函数表达式
2015/06/03 Javascript
jQuery插件EnPlaceholder实现输入框提示文字
2015/06/05 Javascript
JavaScript中的acos()方法使用详解
2015/06/14 Javascript
用JS中split方法实现彩色文字背景效果实例
2016/08/24 Javascript
JS简单随机数生成方法
2016/09/05 Javascript
javascript 判断当前浏览器版本并判断ie版本
2017/02/17 Javascript
JS实现批量上传文件并显示进度功能
2017/06/27 Javascript
webpack构建vue项目的详细教程(配置篇)
2017/07/17 Javascript
浅析从vue源码看观察者模式
2018/01/29 Javascript
Vue.js子组件向父组件通信的方法实例代码详解
2018/12/10 Javascript
简单了解微信小程序的目录结构
2019/07/01 Javascript
[01:00]选手抵达华西村 整装待发备战2016国际邀请赛中国区预选赛
2016/06/25 DOTA
wxPython窗口中文乱码解决方法
2014/10/11 Python
Python使用Supervisor来管理进程的方法
2015/05/28 Python
在Python程序中操作MySQL的基本方法
2015/07/29 Python
Python3实现爬虫爬取赶集网列表功能【基于request和BeautifulSoup模块】
2018/12/05 Python
解析Python 偏函数用法全方位实现
2020/06/26 Python
python安装第三方库如xlrd的方法
2020/10/31 Python
绘儿乐产品官方在线商店:Crayola.com
2019/09/07 全球购物
如何获得EntityManager
2014/02/09 面试题
应届毕业生个人自荐信范文
2013/11/30 职场文书
成语的广告词
2014/03/19 职场文书
马智宇婚礼主持词
2014/03/22 职场文书
信用卡工资证明格式
2014/09/13 职场文书
公司委托书格式范文
2014/10/09 职场文书
司法局群众路线教育实践活动整改措施思想汇报
2014/10/13 职场文书
股东大会通知
2015/04/24 职场文书
呼啸山庄读书笔记
2015/06/29 职场文书
初中运动会闭幕词范本3篇
2019/12/09 职场文书
总结几个非常实用的Python库
2021/06/26 Python
Nginx进程调度问题详解
2021/09/25 Servers