tensorflow与numpy的版本兼容性问题的解决
更新时间:2021年1月8日 15:21 点击:1536
在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版本兼容性内容请搜索猪先飞以前的文章或继续浏览下面的相关文章希望大家以后多多支持猪先飞!
相关文章
- 今天小编就为大家分享一篇解决tensorflow训练时内存持续增加并占满的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-04-22
从Pytorch模型pth文件中读取参数成numpy矩阵的操作
这篇文章主要介绍了从Pytorch模型pth文件中读取参数成numpy矩阵的操作,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2021-03-04- 这篇文章主要介绍了计算Python Numpy向量之间的欧氏距离实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-05-23
win10安装tensorflow-gpu1.8.0详细完整步骤
这篇文章主要介绍了win10安装tensorflow-gpu1.8.0详细完整步骤,本文给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下...2020-04-22macOS M1(AppleSilicon) 安装TensorFlow环境
苹果为M1芯片的Mac提供了TensorFlow的支持,本文主要介绍了如何给使用M1芯片的macOS安装TensorFlow的环境,感兴趣的可以了解一下...2021-08-13- 今天小编就为大家分享一篇Python-numpy实现灰度图像的分块和合并方式,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-04-27
windows系统Tensorflow2.x简单安装记录(图文)
这篇文章主要介绍了windows系统Tensorflow2.x简单安装记录(图文),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2021-01-18Python编程OpenCV和Numpy图像处理库实现图片去水印
这篇文章主要介绍了Python编程中如何实现图片去水印本文采用了OpenCV和Numpy的图像处理的方法来实现,文中附含详细示例代码,有需要的朋友可以借鉴参考下...2021-09-26- 这篇文章主要介绍了引用numpy出错 解决方法的相关资料,需要的朋友可以参考下...2020-04-25
- 这篇文章主要介绍了numpy的squeeze函数使用方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2021-03-22
完美解决TensorFlow和Keras大数据量内存溢出的问题
这篇文章主要介绍了完美解决TensorFlow和Keras大数据量内存溢出的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-07-04- 今天小编就为大家分享一篇Tensorflow读取并输出已保存模型的权重数值方式,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看不看...2020-04-30
- 这篇文章主要介绍了python numpy实现rolling滚动案例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-06-08
在tensorflow下利用plt画论文中loss,acc等曲线图实例
这篇文章主要介绍了在tensorflow下利用plt画论文中loss,acc等曲线图实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-06-16Python通过TensorFLow进行线性模型训练原理与实现方法详解
这篇文章主要介绍了Python通过TensorFLow进行线性模型训练原理与实现方法,结合实例形式详细分析了Python通过TensorFLow进行线性模型训练相关概念、算法设计与训练操作技巧,需要的朋友可以参考下...2020-04-27详解tf.device()指定tensorflow运行的GPU或CPU设备实现
这篇文章主要介绍了详解tf.device()指定tensorflow运行的GPU或CPU设备实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2021-02-20- 今天小编就为大家分享一篇tensorflow实现对张量数据的切片操作方式,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-04-22
- 这篇文章主要介绍了基于tensorflow for循环 while循环案例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-06-30
- 今天小编就为大家分享一篇从训练好的tensorflow模型中打印训练变量实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-04-22
tensorflow -gpu安装方法(不用自己装cuda,cdnn)
这篇文章主要介绍了tensorflow -gpu安装,史上最新最简单的途径(不用自己装cuda,cdnn),非常不错,具有一定的参考借鉴价值,需要的朋友可以参考下...2020-04-22