GitHub上下载的《flaskweb开发》的代码运行不了


Connected to pydev debugger (build 139.1001)
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.4\helpers\pydev\pydevd.py", line 2222, in <module>


 globals = debugger.run(setup['file'], None, None)

File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.4\helpers\pydev\pydevd.py", line 1648, in run


 pydev_imports.execfile(file, globals, locals)  # execute the script

File "D:/venv/flasky-master/app/__init__.py", line 1, in <module>


 from flask import Flask

File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.4\helpers\pydev_pydev_imps_pydev_pluginbase.py", line 452, in plugin_import


 fromlist, level)

File "C:\Python27\lib\site-packages\flask__init__.py", line 17, in <module>


 from werkzeug.exceptions import abort

File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.4\helpers\pydev_pydev_imps_pydev_pluginbase.py", line 452, in plugin_import


 fromlist, level)

File "C:\Python27\lib\site-packages\werkzeug__init__.py", line 154, in <module>


 __import__('werkzeug.exceptions')

File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.4\helpers\pydev_pydev_imps_pydev_pluginbase.py", line 452, in plugin_import


 fromlist, level)

File "C:\Python27\lib\site-packages\werkzeug\exceptions.py", line 71, in <module>


 from werkzeug.wrappers import Response

File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.4\helpers\pydev_pydev_imps_pydev_pluginbase.py", line 452, in plugin_import


 fromlist, level)

File "C:\Python27\lib\site-packages\werkzeug\wrappers.py", line 26, in <module>


 from werkzeug.http import HTTP_STATUS_CODES, \

File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.4\helpers\pydev_pydev_imps_pydev_pluginbase.py", line 452, in plugin_import


 fromlist, level)

File "C:\Python27\lib\site-packages\werkzeug\http.py", line 24, in <module>


 from email.Utils import parsedate_tz

File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.4\helpers\pydev_pydev_imps_pydev_pluginbase.py", line 452, in plugin_import


 fromlist, level)

File "D:/venv/flasky-master/app\email.py", line 2, in <module>


 from flask import current_app, render_template

ImportError: cannot import name current_app

不知道是哪里出了问题。。查询无果

python-flask

三倍速的番茄 9 years, 4 months ago

从所报的错误来看,是引用上的错误,即使你下载了导入,其中的代码也会有对外的很多依赖,你需要自己再去下载框架和所需依赖包,根据源代码提供方的相关提示,下载相应依赖。

米特兰的左德 answered 9 years, 4 months ago

Your Answer