Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requirements.txt 中包版本的问题 #3

Closed
zyy2477 opened this issue Apr 20, 2022 · 1 comment
Closed

requirements.txt 中包版本的问题 #3

zyy2477 opened this issue Apr 20, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@zyy2477
Copy link

zyy2477 commented Apr 20, 2022

在requirements.txt 中使用的Flask版本是0.12.1,代码运行的时候会报ImportError: cannot import name 'Markup' from 'jinja2'错误,

Traceback (most recent call last):
  File "run.py", line 3, in <module>
    from accountpool.scheduler import Scheduler
  File "/data/web-spider2/chapter10/10.4/AccountPool/accountpool/scheduler.py", line 3, in <module>
    from accountpool.processors.server import app
  File "/data/web-spider2/chapter10/10.4/AccountPool/accountpool/processors/server.py", line 2, in <module>
    from flask import Flask, g
  File "/root/.virtualenvs/accountpool/lib/python3.8/site-packages/flask/__init__.py", line 19, in <module>
    from jinja2 import Markup, escape
ImportError: cannot import name 'Markup' from 'jinja2' (/root/.virtualenvs/accountpool/lib/python3.8/site-packages/jinja2/__init__.py)

和缺少 MarkupSafe ,报以下错误:

Traceback (most recent call last):
  File "run.py", line 3, in <module>
    from accountpool.scheduler import Scheduler
  File "/data/web-spider2/chapter10/10.4/AccountPool/accountpool/scheduler.py", line 3, in <module>
    from accountpool.processors.server import app
  File "/data/web-spider2/chapter10/10.4/AccountPool/accountpool/processors/server.py", line 2, in <module>
    from flask import Flask, g
  File "/root/.virtualenvs/accountpool/lib/python3.8/site-packages/flask/__init__.py", line 14, in <module>
    from jinja2 import escape
  File "/root/.virtualenvs/accountpool/lib/python3.8/site-packages/jinja2/__init__.py", line 12, in <module>
    from .environment import Environment
  File "/root/.virtualenvs/accountpool/lib/python3.8/site-packages/jinja2/environment.py", line 25, in <module>
    from .defaults import BLOCK_END_STRING
  File "/root/.virtualenvs/accountpool/lib/python3.8/site-packages/jinja2/defaults.py", line 3, in <module>
    from .filters import FILTERS as DEFAULT_FILTERS  # noqa: F401
  File "/root/.virtualenvs/accountpool/lib/python3.8/site-packages/jinja2/filters.py", line 13, in <module>
    from markupsafe import soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/root/.virtualenvs/accountpool/lib/python3.8/site-packages/markupsafe/__init__.py)

需要把改成 Flask==0.12.1改成Flask==1.1.4,和添加MarkupSafe==2.0.1

@zyy2477 zyy2477 added the bug Something isn't working label Apr 20, 2022
@Germey
Copy link
Member

Germey commented May 8, 2022

谢谢,已经修改~

@Germey Germey closed this as completed May 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants