编辑:一个mod将此帖子标记为this线程的重复,但是该线程中的问题与scipy有关,只需通过使用--no-wheel标志重新安装scipy即可解决。我正在安装tensorflow,该线程中列出的解决方案无法解决问题。另一个常见的答案是抑制警告,我认为这不是一个很好的解决方案。
当我使用Python导入tensorflow时出现一个奇怪的错误。该消息显示numpy.dtype大小已更改。下面是我的控制台输出的副本。我正在运行Ubuntu 18.04 LTS。
sam@sam-MS-7B46:~$ python3
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
/usr/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
return f(*args, **kwds)
/usr/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
return f(*args, **kwds)
我已经安装了所有正确的依赖项。这是pipdeptree的片段,显示了已安装的依赖关系和要求。
tensorflow-gpu==1.9.0
- absl-py [required: >=0.1.6, installed: 0.2.2]
- six [required: Any, installed: 1.11.0]
- astor [required: >=0.6.0, installed: 0.7.1]
- gast [required: >=0.2.0, installed: 0.2.0]
- grpcio [required: >=1.8.6, installed: 1.13.0]
- six [required: >=1.5.2, installed: 1.11.0]
- numpy [required: >=1.13.3, installed: 1.15.0]
- protobuf [required: >=3.4.0, installed: 3.6.0]
- setuptools [required: Any, installed: 39.2.0]
- six [required: >=1.9, installed: 1.11.0]
- setuptools [required: <=39.1.0, installed: 39.2.0]
- six [required: >=1.10.0, installed: 1.11.0]
- tensorboard [required: >=1.9.0,<1.10.0, installed: 1.9.0]
- markdown [required: >=2.6.8, installed: 2.6.11]
- numpy [required: >=1.12.0, installed: 1.15.0]
- protobuf [required: >=3.4.0, installed: 3.6.0]
- setuptools [required: Any, installed: 39.2.0]
- six [required: >=1.9, installed: 1.11.0]
- six [required: >=1.10.0, installed: 1.11.0]
- werkzeug [required: >=0.11.10, installed: 0.14.1]
- wheel [required: >=0.26, installed: 0.31.1]
- termcolor [required: >=1.1.0, installed: 1.1.0]
- wheel [required: >=0.26, installed: 0.31.1]
如您所见,我的numpy安装符合要求。当我在virtualenv中安装时,一切正常,但是我想本地运行tensorflow,却遇到了这个奇怪的错误。
此消息的含义是什么,我该如何解决该问题?
谢谢