导入Tensorflow时如何修复ImportError

时间:2019-03-26 09:22:30

标签: python tensorflow import jupyter

我正在尝试在Jupyter笔记本上导入Tensorflow,它给出了如下所述的错误。

这是在错误地运行!pip install -q tf-nightly之后发生的。

我尝试几次重新安装conda和tensorflow,但是每次运行都显示相同的错误:将tensorflow导入为tf

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
ImportError: numpy.core.multiarray failed to import

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

SystemError                               Traceback (most recent call last)
~\Anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)

SystemError: <class '_frozen_importlib._ModuleLockManager'> returned a result with an error set

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
ImportError: numpy.core._multiarray_umath failed to import

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
ImportError: numpy.core.umath failed to import

1 个答案:

答案 0 :(得分:0)

请尝试升级numpy。

您可以使用以下对我来说很好的命令。

pip install opencv-python == 3.4.2.17 numpy == 1.14.5