我刚刚在我的窗口系统上安装了 pip Flask 和 HTML5。当我使用 IDLE 启动 Hello World! 程序时,我在 Firefox 的新选项卡中得到了正确的文本。而且 Python shell 中也有很多错误消息:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1519, 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:\Python33\lib\site-packages\werkzeug\utils.py", line 18, in <module>
from html.entities import name2codepoint
ImportError: No module named 'html.entities'; html is not a package
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/Public/python/testflask.py", line 13, in <module>
from flask import Flask
File "C:\Python33\lib\site-packages\flask\__init__.py", line 17, in <module>
from werkzeug.exceptions import abort
File "C:\Python33\lib\site-packages\werkzeug\__init__.py", line 154, in <module>
__import__('werkzeug.exceptions')
File "C:\Python33\lib\site-packages\werkzeug\exceptions.py", line 71, in <module>
from werkzeug.wrappers import Response
File "C:\Python33\lib\site-packages\werkzeug\wrappers.py", line 36, in <module>
from werkzeug.utils import cached_property, environ_property, \
File "C:\Python33\lib\site-packages\werkzeug\utils.py", line 20, in <module>
from htmlentitydefs import name2codepoint
ImportError: No module named 'htmlentitydefs'
救命啊!帮助!救命!
最佳答案
您有一个本地 html.py
模块或 html
包来屏蔽内置库。重命名它,因为它破坏了依赖标准库版本的软件。
您可以通过以下方式找到需要重命名或移至一边的文件:
import html
print(html)
将该文件重命名为其他名称。考虑到可能还有一个 .pyc
文件;全部删除 .pyc
字节码缓存(如果存在)。
关于Python33, flask : Lot of Errors starting Hello World,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25042500/