ModuleNotFoundError:没有名为“ numpy.core._multiarray_umath”的模块(安装TensorFlow时)

use*_*308 10 python installation numpy windows-10 tensorflow

我正在按照本教程安装TensorFlow(https://www.tensorflow.org/install/pip),但是在最后一个命令中:

python -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"
Run Code Online (Sandbox Code Playgroud)

我得到这个结果:

ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ImportError: numpy.core.multiarray failed to import

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 980, in _find_and_load
SystemError: <class '_frozen_importlib._ModuleLockManager'> returned a result with an error set
ImportError: numpy.core._multiarray_umath failed to import
ImportError: numpy.core.umath failed to import
2019-02-16 12:56:50.178364: F tensorflow/python/lib/core/bfloat16.cc:675] Check failed: PyBfloat16_Type.tp_base != nullptr
Run Code Online (Sandbox Code Playgroud)

numpy如您所见,我已经安装了:

pip3 install numpy
Requirement already satisfied: numpy in c:\programdata\anaconda3\lib\site-packages (1.15.4)
Run Code Online (Sandbox Code Playgroud)

那么,为什么我会收到此错误消息?如何在Windows 10上修复它?

use*_*308 14

我升级numpy1.16.1版本,然后再次尝试了上述命令:

python -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"
Run Code Online (Sandbox Code Playgroud)

得到了这个新结果:

2019-02-16 13:12:40.611105: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
tf.Tensor(-1714.2305, shape=(), dtype=float32)
Run Code Online (Sandbox Code Playgroud)

  • 将numpy从1.15.4升级到1.16.1也为我解决了这一问题。 (5认同)
  • 这意味着您已经成功安装了Tensorflow。 (2认同)

Ter*_*r17 7

升级numpy以解决错误

pip install numpy --upgrade
Run Code Online (Sandbox Code Playgroud)

  • 这解决了它。Tensorflow 1.13 需要 Numpy 1.16,而我有 1.14。 (2认同)