【问题标题】:Error in importing tensorflow ( python 3.6x )导入张量流时出错(python 3.6x)
【发布时间】:2019-04-01 17:21:30
【问题描述】:
import error tensorflow in python 3.6.0
Failed to load the native TensorFlow runtime.
ImportError: DLL load failed: The specified module could not be found.

>>> import tensorflow
Traceback (most recent call last):
  File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
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.
>>>

【问题讨论】:

  • 您检查过您链接的错误页面吗?并在这里尝试过任何东西? github.com/tensorflow/tensorflow/issues/22794
  • 欢迎来到 SO。请查看this guide,了解如何在本网站上提出一个好问题。在这种情况下,请说明上下文,您要达到的目标,到目前为止您为解决问题所做的尝试......

标签: python python-3.x tensorflow pip


【解决方案1】:

这可能是因为它是作为 Python 2 包安装的,而您运行的是 Python 3 或相反的版本。

要专门为 Python 3 安装包,请尝试输入以下命令:

pip3 install tensorflow

python3 -m pip install tensorflow

要专门为 Python 2 安装包,请尝试输入以下命令:

pip2 install tensorflow

python -m pip install tensorflow

【讨论】:

  • tensorflow 仅适用于 Python 3。
猜你喜欢
  • 2016-03-10
  • 2017-11-28
  • 1970-01-01
  • 2023-03-07
  • 2018-07-06
  • 2017-02-11
  • 2023-01-25
  • 1970-01-01
相关资源
最近更新 更多