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通过邮件服务器端口发送邮件的方法
Apr 30 Python
python中的计时器timeit的使用方法
Oct 20 Python
基于DataFrame筛选数据与loc的用法详解
May 18 Python
Python二进制串转换为通用字符串的方法
Jul 23 Python
Python实现的tcp端口检测操作示例
Jul 24 Python
Python3爬楼梯算法示例
Mar 04 Python
Python数据报表之Excel操作模块用法分析
Mar 11 Python
详解Python time库的使用
Oct 10 Python
python yield关键词案例测试
Oct 15 Python
解决Tensorboard可视化错误:不显示数据 No scalar data was found
Feb 15 Python
解决python cv2.imread 读取中文路径的图片返回为None的问题
Jun 02 Python
Python3使用tesserocr识别字母数字验证码的实现
Jan 29 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中使用hidef扩展代替define提高性能
2015/04/09 PHP
jQuery中change事件用法实例
2014/12/26 Javascript
JS清除文本框内容离开在恢复及鼠标离开文本框时触发js的方法
2016/01/12 Javascript
详解JavaScript模块化开发
2016/12/04 Javascript
利用jquery实现实时更新歌词的方法
2017/01/06 Javascript
node koa2实现上传图片并且同步上传到七牛云存储
2017/07/31 Javascript
vue 导航内容设置选中状态样式的例子
2019/11/01 Javascript
JavaScript this使用方法图解
2020/02/04 Javascript
vue实现拖拽进度条
2021/03/01 Vue.js
[02:19]2014DOTA2国际邀请赛 专访820少年们一起去追梦吧
2014/07/14 DOTA
Python中使用异常处理来判断运行的操作系统平台方法
2015/01/22 Python
Python脚本实现DNSPod DNS动态解析域名
2015/02/14 Python
python获取指定时间差的时间实例详解
2017/04/11 Python
详解Python里使用正则表达式的ASCII模式
2017/11/02 Python
python中reader的next用法
2018/07/24 Python
Python实现的排列组合、破解密码算法示例
2019/04/12 Python
python 进程的几种创建方式详解
2019/08/29 Python
在Python中画图(基于Jupyter notebook的魔法函数)
2019/10/28 Python
python3通过udp实现组播数据的发送和接收操作
2020/05/05 Python
没编程基础可以学python吗
2020/06/17 Python
OpenCV 使用imread()函数读取图片的六种正确姿势
2020/07/09 Python
Jupyter Notebook 远程访问配置详解
2021/01/11 Python
CSS3转换功能transform主要属性值分析及实现分享
2012/05/06 HTML / CSS
HTML5 canvas 基本语法
2009/08/26 HTML / CSS
HTML5 Canvas的常用线条属性值总结
2016/03/17 HTML / CSS
耐克美国官网:Nike.com
2016/08/01 全球购物
捷克家具销售网站:SCONTO Nábytek
2020/01/02 全球购物
支行行长竞聘演讲稿
2014/05/15 职场文书
年度安全生产目标责任书
2014/07/23 职场文书
奥巴马经典演讲稿
2014/09/13 职场文书
建党伟业电影观后感
2015/06/01 职场文书
环境卫生整治简报
2015/07/20 职场文书
创业计划书之少年玩具店
2019/09/05 职场文书
.Net Core导入千万级数据至Mysql的步骤
2021/05/24 MySQL
MYSQL 运算符总结
2021/11/11 MySQL