TensorFlow ImportError: initialization failed

ImportError: initialization failed

报错内容:

D:\Users\Administrator\miniconda3\envs\pynew\lib\site-packages\numpy\core\__init__.py:29: UserWarning: loaded more than 1 DLL from .libs:
D:\Users\Administrator\miniconda3\envs\pynew\lib\site-packages\numpy\.libs\libopenblas.TXA6YQSD3GCQQC22GEQ54J2UDCXDXHWN.gfortran-win_amd64.dll
D:\Users\Administrator\miniconda3\envs\pynew\lib\site-packages\numpy\.libs\libopenblas.XWYDX2IKJW2NMTWSFYNGFUWKQU3LYTCZ.gfortran-win_amd64.dll
  stacklevel=1)
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
ImportError: numpy.core.multiarray failed to import

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

SystemError: returned a result with an error set

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

Traceback (most recent call last):
  File "D:\Users\Administrator\miniconda3\envs\pynew\lib\runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "D:\Users\Administrator\miniconda3\envs\pynew\lib\runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "D:\Users\Administrator\miniconda3\envs\pynew\lib\site-packages\tf2onnx\__init__.py", line 10, in
    from . import verbose_logging as logging
  File "D:\Users\Administrator\miniconda3\envs\pynew\lib\site-packages\tf2onnx\verbose_logging.py", line 14, in
    import tensorflow as tf
  File "D:\Users\Administrator\miniconda3\envs\pynew\lib\site-packages\tensorflow\__init__.py", line 37, in
    from tensorflow.python.tools import module_util as _module_util
  File "D:\Users\Administrator\miniconda3\envs\pynew\lib\site-packages\tensorflow\python\__init__.py", line 37, in
    from tensorflow.python.eager import context
  File "D:\Users\Administrator\miniconda3\envs\pynew\lib\site-packages\tensorflow\python\eager\context.py", line 35, in
    from tensorflow.python.client import pywrap_tf_session
  File "D:\Users\Administrator\miniconda3\envs\pynew\lib\site-packages\tensorflow\python\client\pywrap_tf_session.py", line 19, in
    from tensorflow.python.client._pywrap_tf_session import *
ImportError: initialization failed

解决方法:重装numpy

pip uninstall numpy

pip install numpy

你可能感兴趣的:(tensorflow,tensorflow,python,numpy)