【发布时间】:2014-05-29 15:31:38
【问题描述】:
我已经开始学习 Flask。我想我已经正确安装了它,但它给了我错误,我不知道为什么。
我得到了 Flask 网站的这个例子,我正在运行 Python 3.4
代码如下:
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
这是错误:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2195, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'
during the handling of this error several other error occurred. Does this code not work on 3.4, or is something not installed right.
编辑: 这是完整的错误
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2195, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\werkzeug\http.py", line 22, in <module>
from email.utils import parsedate_tz
File "D:\Documents\PythonScripts\More Advanced\email.py", line 1, in <module>
import smtplib
File "C:\Python34\lib\smtplib.py", line 47, in <module>
import email.utils
ImportError: No module named 'email.utils'; 'email' is not a package
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2195, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Documents\PythonScripts\More Advanced\test.py", line 1, in <module>
from flask import Flask
File "C:\Python34\lib\site-packages\flask\__init__.py", line 17, in <module>
from werkzeug.exceptions import abort
File "C:\Python34\lib\site-packages\werkzeug\__init__.py", line 154, in <module>
__import__('werkzeug.exceptions')
File "C:\Python34\lib\site-packages\werkzeug\exceptions.py", line 71, in <module>
from werkzeug.wrappers import Response
File "C:\Python34\lib\site-packages\werkzeug\wrappers.py", line 26, in <module>
from werkzeug.http import HTTP_STATUS_CODES, \
File "C:\Python34\lib\site-packages\werkzeug\http.py", line 24, in <module>
from email.Utils import parsedate_tz
File "D:\Documents\PythonScripts\More Advanced\email.py", line 1, in <module>
import smtplib
File "C:\Python34\lib\smtplib.py", line 47, in <module>
import email.utils
ImportError: No module named 'email.utils'; 'email' is not a package
【问题讨论】:
-
这是完整的回溯吗?应该有比这更多的行。
标签: python python-3.x flask runtime-error