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中的特殊语法:filter、map、reduce、lambda介绍
Apr 14 Python
python中的代码编码格式转换问题
Jun 10 Python
Python连接数据库学习之DB-API详解
Feb 07 Python
Python实现基本数据结构中栈的操作示例
Dec 04 Python
Tensorflow使用支持向量机拟合线性回归
Sep 07 Python
Ubuntu下Python2与Python3的共存问题
Oct 31 Python
python将excel转换为csv的代码方法总结
Jul 03 Python
Python使用微信接入图灵机器人过程解析
Nov 04 Python
tensorflow实现在函数中用tf.Print输出中间值
Jan 21 Python
python 双循环遍历list 变量判断代码
May 04 Python
Django数据库迁移常见使用方法
Nov 12 Python
Python标准库pathlib操作目录和文件
Nov 20 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
下拉列表选择项的选中在不同浏览器中的兼容性问题探讨
2013/09/18 Javascript
浅析JavaScript原型继承的陷阱
2013/12/03 Javascript
JavaScript中的prototype和constructor简明总结
2014/04/05 Javascript
jquery解析xml字符串简单示例
2014/04/11 Javascript
js unicode 编码解析关于数据转换为中文的两种方法
2014/04/21 Javascript
JS实现鼠标经过好友列表中的好友头像时显示资料卡的效果
2014/07/02 Javascript
angularjs学习笔记之双向数据绑定
2015/09/26 Javascript
Javascript数组Array基础介绍
2016/03/13 Javascript
jQuery代码实现对话框右上角菜单带关闭×
2016/05/03 Javascript
jQuery自定义图片缩放拖拽插件imageQ实现方法(附demo源码下载)
2016/05/27 Javascript
滚动条的监听与内容随着滚动条动态加载的实现
2017/02/08 Javascript
AngularJS入门教程二:在路由中传递参数的方法分析
2017/05/27 Javascript
Vue.js分页组件实现:diVuePagination的使用详解
2018/01/10 Javascript
Vue的transition-group与Virtual Dom Diff算法的使用
2019/12/09 Javascript
python中常用的九种预处理方法分享
2016/09/11 Python
python的unittest测试类代码实例
2017/12/07 Python
python将回车作为输入内容的实例
2018/06/23 Python
使用python实现http及ftp服务进行数据传输的方法
2018/10/26 Python
Python numpy中矩阵的基本用法汇总
2019/02/12 Python
Python 用matplotlib画以时间日期为x轴的图像
2019/08/06 Python
利用python实现凯撒密码加解密功能
2020/03/31 Python
Python中Selenium库使用教程详解
2020/07/23 Python
深入了解Python 变量作用域
2020/07/24 Python
python 如何使用find和find_all爬虫、找文本的实现
2020/10/16 Python
美国运动鞋和服装网上商店:YCMC
2018/09/15 全球购物
英国最大的宝石首饰超市:QP Jewellers
2018/09/23 全球购物
C/C++有关内存的思考题
2015/12/04 面试题
药学专业大学生个人的自我评价
2013/11/04 职场文书
高中体育教学反思
2014/01/24 职场文书
购房意向书
2014/04/01 职场文书
高二学生评语大全
2014/04/25 职场文书
奥林匹克运动会口号
2014/06/19 职场文书
2014年保密工作总结
2014/11/22 职场文书
文明倡议书
2015/01/19 职场文书
2015年党支部公开承诺书
2015/01/22 职场文书
如何通过cmd 连接阿里云服务器
2022/04/18 Servers