jupyter笔记本中运行的keras,Windows 10,64位系统

问题描述 投票:-3回答:1

运行keras给我以下错误:

Using TensorFlow backend.
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.
Traceback (most recent call last):
  File "c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "c:\users\chetan garg\appdata\local\programs\python\python36\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "c:\users\chetan garg\appdata\local\programs\python\python36\lib\imp.py", line 343, 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 "c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\IPython\core\interactiveshell.py", line 2034, in showtraceback
    stb = value._render_traceback_()
AttributeError: 'ImportError' object has no attribute '_render_traceback_'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\IPython\core\interactiveshell.py", line 3242, in run_ast_nodes
    if (await self.run_code(code, result,  async_=asy)):
  File "c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\IPython\core\interactiveshell.py", line 3336, in run_code
    self.showtraceback(running_compiled_code=True)
  File "c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\IPython\core\interactiveshell.py", line 2037, in showtraceback
    value, tb, tb_offset=tb_offset)
  File "c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\IPython\core\ultratb.py", line 1418, in structured_traceback
    self, etype, value, tb, tb_offset, number_of_lines_of_context)
  File "c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\IPython\core\ultratb.py", line 1318, in structured_traceback
    self, etype, value, tb, tb_offset, number_of_lines_of_context
  File "c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\IPython\core\ultratb.py", line 1186, in structured_traceback
    formatted_exceptions += self.prepare_chained_exception_message(evalue.__cause__)
TypeError: must be str, not list
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\IPython\core\interactiveshell.py", line 2034, in showtraceback
    stb = value._render_traceback_()
AttributeError: 'TypeError' object has no attribute '_render_traceback_'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "c:\users\chetan garg\appdata\local\programs\python\python36\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "c:\users\chetan garg\appdata\local\programs\python\python36\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/errors
for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py in <module>
     57 
---> 58   from tensorflow.python.pywrap_tensorflow_internal import *
     59   from tensorflow.python.pywrap_tensorflow_internal import __version__
c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py in <module>
     27             return _mod
---> 28     _pywrap_tensorflow_internal = swig_import_helper()
     29     del swig_import_helper

c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py in swig_import_helper()
     23             try:
---> 24                 _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
     25             finally:

c:\users\chetan garg\appdata\local\programs\python\python36\lib\imp.py in load_module(name, file, filename, details)
    242         else:
--> 243             return load_dynamic(name, filename, file)
    244     elif type_ == PKG_DIRECTORY:
c:\users\chetan garg\appdata\local\programs\python\python36\lib\imp.py in load_dynamic(name, path, file)
    342             name=name, loader=loader, origin=path)
--> 343         return _load(spec)
    344 
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred
During handling of the above exception, another exception occurred:
AttributeError                            Traceback (most recent call last)
c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\IPython\core\interactiveshell.py in showtraceback(self, exc_tuple, filename, tb_offset, exception_only, running_compiled_code)
   2033                         # in the engines. This should return a list of strings.
-> 2034                         stb = value._render_traceback_()
   2035                     except Exception:
AttributeError: 'ImportError' object has no attribute '_render_traceback_'
During handling of the above exception, another exception occurred:
TypeError                                 Traceback (most recent call last)
c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\IPython\core\interactiveshell.py in run_code(self, code_obj, result, async_)
   3334             if result is not None:
   3335                 result.error_in_exec = sys.exc_info()[1]
-> 3336             self.showtraceback(running_compiled_code=True)
   3337         else:
   3338             outflag = False
c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\IPython\core\interactiveshell.py in showtraceback(self, exc_tuple, filename, tb_offset, exception_only, running_compiled_code)
   2035                     except Exception:
   2036                         stb = self.InteractiveTB.structured_traceback(etype,
-> 2037                                             value, tb, tb_offset=tb_offset)
   2038 
   2039                     self._showtraceback(etype, value, stb)
c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\IPython\core\ultratb.py in structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)
   1416             self.tb = tb
   1417         return FormattedTB.structured_traceback(
-> 1418             self, etype, value, tb, tb_offset, number_of_lines_of_context)
   1419 
   1420 
c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\IPython\core\ultratb.py in structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)
   1316             # Verbose modes need a full traceback
   1317             return VerboseTB.structured_traceback(
-> 1318                 self, etype, value, tb, tb_offset, number_of_lines_of_context
   1319             )
   1320         elif mode == 'Minimal':
c:\users\chetan garg\appdata\local\programs\python\python36\lib\site-packages\IPython\core\ultratb.py in structured_traceback(self, etype, evalue, etb, tb_offset, number_of_lines_of_context)
   1184         exception = self.get_parts_of_chained_exception(evalue)
   1185         if exception:
-> 1186             formatted_exceptions += self.prepare_chained_exception_message(evalue.__cause__)
   1187             etype, evalue, etb = exception
   1188         else:
TypeError: must be str, not list
n_pts = 100
python-3.x tensorflow keras jupyter-notebook command-prompt
1个回答
0
投票

尝试卸载并安装TensorFlow。如果您使用conda:

conda uninstall tensorflow
conda uninstall keras
conda install tensorflow
conda install keras

下一次,最好提供您运行的代码,而不仅仅是错误。在这种情况下,人们可以更好地帮助您。

© www.soinside.com 2019 - 2024. All rights reserved.