tensorflow与numpy的版本兼容性问题的解决
在Python交互式窗口导入tensorflow出现了下面的错误:
root@ubuntu:~#python3 Python3.6.8(default,Oct72019,12:59:55) [GCC8.3.0]onlinux Type"help","copyright","credits"or"license"formoreinformation. >>>importtensorflowastf; /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:516:FutureWarning:Passing(type,1)or'1type'asasynonymoftypeisdeprecated;inafutureversionofnumpy,itwillbeunderstoodas(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'asasynonymoftypeisdeprecated;inafutureversionofnumpy,itwillbeunderstoodas(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'asasynonymoftypeisdeprecated;inafutureversionofnumpy,itwillbeunderstoodas(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'asasynonymoftypeisdeprecated;inafutureversionofnumpy,itwillbeunderstoodas(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'asasynonymoftypeisdeprecated;inafutureversionofnumpy,itwillbeunderstoodas(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'asasynonymoftypeisdeprecated;inafutureversionofnumpy,itwillbeunderstoodas(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'asasynonymoftypeisdeprecated;inafutureversionofnumpy,itwillbeunderstoodas(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'asasynonymoftypeisdeprecated;inafutureversionofnumpy,itwillbeunderstoodas(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'asasynonymoftypeisdeprecated;inafutureversionofnumpy,itwillbeunderstoodas(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'asasynonymoftypeisdeprecated;inafutureversionofnumpy,itwillbeunderstoodas(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'asasynonymoftypeisdeprecated;inafutureversionofnumpy,itwillbeunderstoodas(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'asasynonymoftypeisdeprecated;inafutureversionofnumpy,itwillbeunderstoodas(type,(1,))/'(1,)type'. np_resource=np.dtype([("resource",np.ubyte,1)])
我的错误原因是numpy的版本较高造成的,换成1.14.0版本后解决了
出错时的Numpy版本
root@ubuntu:~#pip3shownumpy Name:numpy Version:1.17.3 Summary:NumPyisthefundamentalpackageforarraycomputingwithPython. Home-page:https://www.numpy.org Author:TravisE.Oliphantetal. Author-email:None License:BSD Location:/usr/local/lib/python3.6/dist-packages Requires:
安装1.14.0的Numpy版本
root@ubuntu:~#pip3installnumpy==1.14.0 Collectingnumpy==1.14.0 Downloadinghttps://files.pythonhosted.org/packages/dc/ac/5c270dffb864f23315e9c1f9e0a0b300c797b3c170666c031c4de42aacae/numpy-1.14.0-cp36-cp36m-manylinux1_x86_64.whl(17.2MB) 100%|████████████████████████████████|17.2MB75kB/s Installingcollectedpackages:numpy Successfullyinstallednumpy-1.14.0 root@ubuntu:~#python3 Python3.6.8(default,Oct72019,12:59:55) [GCC8.3.0]onlinux Type"help","copyright","credits"or"license"formoreinformation. >>>importtensorflowastf; >>>tf.__version__ '1.14.0' >>>
到此这篇关于tensorflow与numpy的版本兼容性问题的解决的文章就介绍到这了,更多相关tensorflow与numpy版本兼容性内容请搜索毛票票以前的文章或继续浏览下面的相关文章希望大家以后多多支持毛票票!