我安装IDE和Eclipse运行时出现python flask导入错误

时间:2017-07-06 09:59:55

标签: python eclipse web flask cmd

When I Run by Esclipse

# -*- coding: utf-8 -*-

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 "C:\Users\Austyn\git\flask\ch02\hello.py", line 3, in <module>

    from flask import Flask

  File "C:\Python36\myprojects\venv\lib\site-packages\flask\__init__.py",
  line 19, in <module>

    from jinja2 import Markup, escape

  File "C:\Python36\myprojects\venv\lib\site-packages\jinja2\__init__.py",
  line 33, in <module>

    from jinja2.environment import Environment, Template

 File"C:\Python36\myprojects\venv\lib\sitepackages\jinja2\environment.py",
 line 15, in <module>

    from jinja2 import nodes

  File "C:\Python36\myprojects\venv\lib\site-packages\jinja2\nodes.py"line
  19, in <module>

    from jinja2.utils import Markup

  File "C:\Python36\myprojects\venv\lib\site-packages\jinja2\utils.py"line
  624, in <module>

    from markupsafe import Markup, escape, soft_unicode

  File"C:\Python36\myprojects\venv\lib\sipackages\markupsafe\__init__.py",
  line 14, in <module>

    from markupsafe._compat import text_type, string_types, int_types, \

ModuleNotFoundError: No module named 'markupsafe._compat'

当我尝试安装烧瓶时,我遇到了麻烦。 我不知道为什么会出现这个错误。 我错了设置PATH吗? 我认为它不起作用像werkzeug和jinja2和Markupsafe这样的工具...... 但我不知道这是什么。

1 个答案:

答案 0 :(得分:1)

尝试安装markupsafe。

pip install markupsafe