我尝试使用不同版本的TensorFlow,我尝试设置不同的路径,但是无论如何我都会收到以下错误。 我在Windows 7 Professional上使用Spyder v3.2.8,Python v3.6.6和TensorFlow v1.11.0。
导入喀拉拉邦 使用TensorFlow后端 追溯(最近一次通话):
File "<ipython-input-1-88d96843a926>", line 1, in <module>
import keras
File "C:\Users\dchisholm\AppData\Local\Continuum\anaconda3.3.7\envs\Python35\Lib\site-packages\keras\__init__.py", line 3, in <module>
from . import utils
File "C:\Users\dchisholm\AppData\Local\Continuum\anaconda3.3.7\envs\Python35\Lib\site-packages\keras\utils\__init__.py", line 6, in <module>
from . import conv_utils
File "C:\Users\dchisholm\AppData\Local\Continuum\anaconda3.3.7\envs\Python35\Lib\site-packages\keras\utils\conv_utils.py", line 9, in <module>
from .. import backend as K
File "C:\Users\dchisholm\AppData\Local\Continuum\anaconda3.3.7\envs\Python35\Lib\site-packages\keras\backend\__init__.py", line 89, in <module>
from .tensorflow_backend import *
File "C:\Users\dchisholm\AppData\Local\Continuum\anaconda3.3.7\envs\Python35\Lib\site-packages\keras\backend\tensorflow_backend.py", line 5, in <module>
import tensorflow as tf
File "C:\Users\dchisholm\AppData\Local\Continuum\anaconda3.3.7\envs\Python35\Lib\site-packages\tensorflow\__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\dchisholm\AppData\Local\Continuum\anaconda3.3.7\envs\Python35\Lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\dchisholm\AppData\Local\Continuum\anaconda3.3.7\envs\Python35\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\dchisholm\AppData\Local\Continuum\anaconda3.3.7\envs\Python35\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\dchisholm\AppData\Local\Continuum\anaconda3.3.7\envs\Python35\Lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\dchisholm\AppData\Local\Continuum\anaconda3.3.7\envs\Python35\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\dchisholm\AppData\Local\Continuum\anaconda3.3.7\envs\Python35\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\dchisholm\AppData\Local\Continuum\anaconda3.3.7\envs\Python35\lib\imp.py", line 343, 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/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
答案 0 :(得分:0)
我终于弄清楚了问题所在。 python版本必须为3.5.x,所有TensorFlow软件包都必须为1.8.0。我尝试的其他版本版本导致导入失败。
结合使用这些,可以导入keras模块,并且我可以毫无问题地建立ANN。