导入Tensorflow时出错-无法加载本机TensorFlow运行时

时间:2020-08-02 14:30:39

标签: python tensorflow

这是完整的错误:

Traceback (most recent call last):


File "C:\Users\richa\Documents\_Projects_\Astr0loger\interface.py", line 26, in <module>
    from controller import choose_best_stocks
  File "C:\Users\richa\Documents\_Projects_\Astr0loger\controller.py", line 10, in <module>
    from trainer import get_data, train_model, test_model
  File "C:\Users\richa\Documents\_Projects_\Astr0loger\trainer.py", line 12, in <module>
    import tensorflow as tf
  File "C:/Users/richa/Documents/_Projects_/Astr0loger/astrology_env/Lib/site-packages\tensorflow\__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:/Users/richa/Documents/_Projects_/Astr0loger/astrology_env/Lib/site-packages\tensorflow\python\__init__.py", line 40, in <module>
    from tensorflow.python.eager import context
  File "C:/Users/richa/Documents/_Projects_/Astr0loger/astrology_env/Lib/site-packages\tensorflow\python\eager\context.py", line 35, in <module>
    from tensorflow.python import pywrap_tfe
  File "C:/Users/richa/Documents/_Projects_/Astr0loger/astrology_env/Lib/site-packages\tensorflow\python\pywrap_tfe.py", line 28, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:/Users/richa/Documents/_Projects_/Astr0loger/astrology_env/Lib/site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:/Users/richa/Documents/_Projects_/Astr0loger/astrology_env/Lib/site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: The specified module could not be found.


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

显然,有三个常见原因/解决了该问题:

  1. Python是32位,而系统是64位,反之亦然。我检查了,不是这样。
  2. cpu不支持AVX2指令-我尝试过tensorflow-gpu,同样的问题,所以我不认为是这样
  3. 您需要安装MSVC 2019可重新分发-我检查了,我有它

AAAAAAAAAAH我该怎么办?

1 个答案:

答案 0 :(得分:0)

好吧,事实证明该错误是通过安装旧版本的Tensorflow修复的; 2.0.0。如果您遇到相同的问题,请尝试使用多个版本的tensorflow。