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单链表的简单实现方法
Sep 23 Python
Python中利用sorted()函数排序的简单教程
Apr 27 Python
Python 3中的yield from语法详解
Jan 18 Python
浅谈对yield的初步理解
May 29 Python
python 打印直角三角形,等边三角形,菱形,正方形的代码
Nov 21 Python
Pandas中把dataframe转成array的方法
Apr 13 Python
Win10系统下安装labelme及json文件批量转化方法
Jul 30 Python
python multiprocessing模块用法及原理介绍
Aug 20 Python
Python 在OpenCV里实现仿射变换—坐标变换效果
Aug 30 Python
Python生态圈图像格式转换问题(推荐)
Dec 02 Python
python3爬虫GIL修改多线程实例讲解
Nov 24 Python
python 如何用urllib与服务端交互(发送和接收数据)
Mar 04 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
Yii2 输出xml格式数据的方法
2016/05/03 PHP
php实现的XML操作(读取)封装类完整实例
2017/02/23 PHP
弹出模态框modal的实现方法及实例
2017/09/19 PHP
PHP结合jquery ajax实现上传多张图片,并限制图片大小操作示例
2019/03/01 PHP
FormValid0.5版本发布,带ajax自定义验证例子
2007/08/17 Javascript
jquery 1.3.2 IE8中的一点点的小问题解决方法
2009/07/10 Javascript
jquery ajax 同步异步的执行示例代码
2010/06/23 Javascript
JS 添加千分位与去掉千分位的示例
2013/07/11 Javascript
JS禁用浏览器退格键实现思路及代码
2013/10/29 Javascript
jquery $.trim()方法使用介绍
2014/05/21 Javascript
使用jQuery管理选择结果
2015/01/20 Javascript
ECMAScript 5严格模式(Strict Mode)介绍
2015/03/02 Javascript
JS实现方向键切换输入框焦点的方法
2015/08/19 Javascript
基于jQuery通过jQuery.form.js插件实现异步上传
2015/12/13 Javascript
javascript中使用未定义变量或值的情况分析
2016/07/19 Javascript
12个非常有用的JavaScript技巧
2017/05/17 Javascript
详解vue中axios的封装
2018/07/18 Javascript
vue使用laydate时间插件的方法
2018/11/14 Javascript
详解vue项目接入微信JSSDK的坑
2018/12/14 Javascript
在node中使用jwt签发与验证token的方法
2019/04/03 Javascript
使用 webpack 插件自动生成 vue 路由文件的方法
2019/08/20 Javascript
基于form-data请求格式详解
2019/10/29 Javascript
如何使用 JavaScript 操作浏览器历史记录 API
2020/11/24 Javascript
[05:15]DOTA2英雄梦之声_第16期_灰烬之灵
2014/06/21 DOTA
Python实现简单的HttpServer服务器示例
2017/09/25 Python
详解django.contirb.auth-认证
2018/07/16 Python
pyqt5使用按钮进行界面的跳转方法
2019/06/19 Python
keras用auc做metrics以及早停实例
2020/07/02 Python
Python 实现PS滤镜的旋涡特效
2020/12/03 Python
纯css3制作的火影忍者写轮眼开眼至轮回眼及进化过程实例
2014/11/11 HTML / CSS
详解HTML5中的picture元素响应式处理图片
2018/01/03 HTML / CSS
电脑售后服务承诺书
2014/03/27 职场文书
元旦晚会活动总结
2014/07/09 职场文书
天猫活动策划方案
2014/08/21 职场文书
python文件目录操作之os模块
2021/05/08 Python
Lakehouse数据湖并发控制陷阱分析
2022/03/31 Oracle