【问题标题】:Flask running on Python3.6 can't find htmlentitydefs? [duplicate]Python3.6上运行的Flask找不到htmlentitydefs? [复制]
【发布时间】:2019-09-17 17:35:59
【问题描述】:

我在断开连接的环境中运行 Python3.6 intel anaconda 发行版。

我安装了以下轮子:

Click-7.0-py2.py3-none-any.whl
Flask-1.1.1-py2.py3-none-any.whl
itsdangerous-1.1.0-py2.py3-none-any.whl
Jinja2-2.10.1-py2.py3-none-any.whl
Werkzeug-0.15.6-py2.py3-none-any.whl

pip 说我的所有要求都已安装,但是当我执行 import flask 时,我收到此错误:

$python
Python 3.6.8 |Intel Corporation| (default, Jan 15 2019, 04:34:13)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux
Type "help", "copyright", "credits" or "license" for more information.
Intel(R) Distribution for Python is brought to you by Intel Corporation.
Please check out: https://software.intel.com/en-us/python-distribution
>>> import flask
Traceback (most recent call last):
  File "/intelpython3_2019.2/lib/python3.6/site-packages/werkzeug/utils.py", line 31, in <module>
    from html.entities import name2codepoint
ModuleNotFoundError: No module named 'html.entities'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/intelpython3_2019.2/lib/python3.6/site-packages/flask/__init__.py", line 16, in <module>
    from werkzeug.exceptions import abort
  File "/intelpython3_2019.2/lib/python3.6/site-packages/werkzeug/__init__.py", line 233, in <module>
    __import__("werkzeug.exceptions")
  File "/intelpython3_2019.2/lib/python3.6/site-packages/werkzeug/exceptions.py", line 73, in <module>
    from .wrappers import Response
  File "/intelpython3_2019.2/lib/python3.6/site-packages/werkzeug/wrappers/__init__.py", line 21, in <module>
    from .accept import AcceptMixin
  File "/intelpython3_2019.2/lib/python3.6/site-packages/werkzeug/wrappers/accept.py", line 5, in <module>
    from ..utils import cached_property
  File "/intelpython3_2019.2/lib/python3.6/site-packages/werkzeug/utils.py", line 33, in <module>
    from htmlentitydefs import name2codepoint
ModuleNotFoundError: No module named 'htmlentitydefs'
>>> 

所以这没有任何意义,因为htmlentitydefs 是 python2 的东西,我在 python3 上运行,我从 python2/python3 轮子安装了所有东西。

我需要安装什么来解决这个问题?

【问题讨论】:

  • hmm 有趣,werkzeug loads 首先是 python 3 版本的 name2codepoint,然后回退到 python 2 版本。我想知道python 3版本是否完全安装。

标签: python python-3.x flask


【解决方案1】:

如果当前目录中有一个名为html的目录,则python在尝试加载html模块时会失败。我在当前目录中做了一个rmdir html,这个问题就消失了。

【讨论】:

  • 你是怎么发现的:D
  • 努力了。这个问题不是重复的。
猜你喜欢
  • 2017-06-10
  • 1970-01-01
  • 2021-11-16
  • 2018-10-11
  • 2021-12-10
  • 1970-01-01
  • 2021-05-11
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多