ImportError Traceback (most recent call last) Cell In[7], line 37 34 return jsonify({'answer': answer}) 36 if __name__ == '__main__': ---> 37 app.run(debug=True) File c:\users\ljimmy\appdata\local\programs\python\python38\lib\site-packages\flask\app.py:914, in Flask.run(self, host, port, debug, load_dotenv, **options) 911 from werkzeug.serving import run_simple 913 try: --> 914 run_simple(t.cast(str, host), port, self, **options) 915 finally: 916 # reset the first request information if the development server 917 # reset normally. This makes it possible to restart the server 918 # without reloader and that stuff from an interactive shell. 919 self._got_first_request = False File c:\users\ljimmy\appdata\local\programs\python\python38\lib\site-packages\werkzeug\serving.py:1097, in run_simple(hostname, port, application, use_reloader, use_debugger, use_evalex, extra_files, exclude_patterns, reloader_interval, reloader_type, threaded, processes, request_handler, static_files, passthrough_errors, ssl_context) 1094 from ._reloader import run_with_reloader 1096 try: -> 1097 run_with_reloader( 1098 srv.serve_forever, 1099 extra_files=extra_files, 1100 exclude_patterns=exclude_patterns, 1101 interval=reloader_interval, 1102 reloader_type=reloader_type, 1103 ) 1104 finally: 1105 srv.server_close() File c:\users\ljimmy\appdata\local\programs\python\python38\lib\site-packages\werkzeug\_reloader.py:440, in run_with_reloader(main_func, extra_files, exclude_patterns, interval, reloader_type) 437 import signal 439 signal.signal(signal.SIGTERM, lambda *args: sys.exit(0)) --> 440 reloader = reloader_loops[reloader_type]( 441 extra_files=extra_files, exclude_patterns=exclude_patterns, interval=interval 442 ) 444 try: 445 if os.environ.get("WERKZEUG_RUN_MAIN") == "true": File c:\users\ljimmy\appdata\local\programs\python\python38\lib\site-packages\werkzeug\_reloader.py:315, in WatchdogReloaderLoop.__init__(self, *args, **kwargs) 313 from watchdog.observers import Observer 314 from watchdog.events import PatternMatchingEventHandler --> 315 from watchdog.events import EVENT_TYPE_OPENED 316 from watchdog.events import FileModifiedEvent 318 super().__init__(*args, **kwargs) ImportError: cannot import name 'EVENT_TYPE_OPENED' from 'watchdog.events' (C:\Users\Ljimmy\AppData\Roaming\Python\Python38\site-packages\watchdog\events.py)
时间: 2024-04-27 19:23:11 浏览: 244
解决ImportError: Could not find 'cudnn64_7.dll'
5星 · 资源好评率100%
根据你提供的信息,这是一个 Python 的 ImportError 异常,异常信息显示无法从 watchdog.events 模块中导入 EVENT_TYPE_OPENED。这可能是因为版本兼容性问题或 watchdog 库未正确安装导致的。建议检查 watchdog 库的安装是否正确,并查看它是否与当前 Python 版本兼容。你可以尝试更新 watchdog 库或卸载并重新安装它。
阅读全文