pip install "numpy<1.17"
恢复为Numpy版本1.16.4
0
pip install "numpy<1.17"
恢复为Numpy版本1.16.4
0
我在使用python3 v3.6中的tensorflow的linux笔记本电脑中遇到了相同的问题
实际上,您只需要在2个文件中更改一些行:
1个
〜/ .local / lib / python3.6 / site-packages / tensorflow / python / framework / dtypes.py
在您的情况下:
C:\Users\PC\Anaconda3\envs\tut\lib\site-packages\tensorflow\python\framework\dtypes.py
现在更改此代码:(第516行)
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
# _np_bfloat16 is defined by a module import.
# Custom struct dtype for directly-fed ResourceHandles of supported type(s).
np_resource = np.dtype([("resource", np.ubyte, 1)])
通过此代码:
_np_qint8 = np.dtype([("qint8", np.int8, (1,))])
_np_quint8 = np.dtype([("quint8", np.uint8, (1,))])
_np_qint16 = np.dtype([("qint16", np.int16, (1,))])
_np_quint16 = np.dtype([("quint16", np.uint16, (1,))])
_np_qint32 = np.dtype([("qint32", np.int32, (1,))])
# _np_bfloat16 is defined by a module import.
# Custom struct dtype for directly-fed ResourceHandles of supported type(s).
np_resource = np.dtype([("resource", np.ubyte, (1,))])
您必须对此文件执行相同的操作:
2
〜/ .local / lib / python3.6 / site-packages / tensorboard / compat / tensorflow_stub / dtypes.py
在您的情况下:
C:\Users\PC\Anaconda3\envs\tut\lib\site-packages\tensorboard/compat/tensorflow_stub/dtypes.py
它会工作。
0
如果您使用的是TF 2.0, 一种快速的解决方案是将numpy降级为1.16.4。 (我使用1.17并收到了相同的警告消息)。
1. pip uninstall numpy
2. pip install numpy==1.16.4
在这里看到 (感谢ymodak)
0
最新的numpy发行说明(1.17)具有:
Future Changes
Shape-1 fields in dtypes won’t be collapsed to scalars in a future version
Currently, a field specified as [(name, dtype, 1)] or "1type" is interpreted
as a scalar field (i.e., the same as [(name, dtype)] or [(name, dtype, ()]).
This now raises a FutureWarning; in a future version, it will be interpreted
as a shape-(1,) field, i.e. the same as [(name, dtype, (1,))] or "(1,)type"
(consistently with [(name, dtype, n)] / "ntype" with n>1, which is already
equivalent to [(name, dtype, (n,)] / "(n,)type").
https://docs.scipy.org/doc/numpy/release.html
因此,您的表情:
In [123]: np.dtype([("qint8", np.int8, 1)])
/usr/local/bin/ipython3:1: 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'.
#!/usr/bin/python3
Out[123]: dtype([('qint8', 'i1')])
In [124]: np.dtype([("qint8", np.int8, (1,))])
Out[124]: dtype([('qint8', 'i1', (1,))])
In [125]: np.dtype([("qint8", np.int8)])
Out[125]: dtype([('qint8', 'i1')])
In [126]: np.dtype([("qint8", np.int8, 2)])
Out[126]: dtype([('qint8', 'i1', (2,))])
In [127]: np.__version__
Out[127]: '1.17.0'
0
这只是一个警告,而不是错误。因为您当前的numpy libray版本与tensorflow版本不兼容而发生。您需要降级numpy版本。
tensorflow 1.10.0
要求为numpy<=1.14.5,>=1.13.3
,但您必须安装一些更高的版本(此警告消息出现在最新的numpy版本1.17.0中)。
0
我安装了TensorFlow 1.10.1,但是当我尝试导入TensorFlow时,它说我需要TensorFlow版本1.10.0。因此,我安装了它,现在收到以下警告: