这是我在python 3.7.2中运行import tensorflow as tf
时的错误消息:-
Traceback (most recent call last):
File "C:\Python 3.7.2 (64-bit)\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Python 3.7.2 (64-bit)\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Python 3.7.2 (64-bit)\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:\Python 3.7.2 (64-bit)\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Python 3.7.2 (64-bit)\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 "E:\First ML Program.py", line 1, in <module>
import tensorflow as tf
File "C:\Python 3.7.2 (64-bit)\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Python 3.7.2 (64-bit)\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Python 3.7.2 (64-bit)\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Python 3.7.2 (64-bit)\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Python 3.7.2 (64-bit)\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Python 3.7.2 (64-bit)\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:\Python 3.7.2 (64-bit)\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Python 3.7.2 (64-bit)\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.
我已经阅读了关于Stackoverflow的类似问题的答案,例如:使用python 3.5,安装tensorflow的cpu版本,使用pip3,但是没有任何效果。请提供解决此令人烦恼的问题的方法。
答案 0 :(得分:0)
需要Python 3.4、3.5或3.6
然后,如果它不起作用,请检查您的PATH
和PYTHONPATH
,pip
和python
的位置。