cannot import name 'environmentfilter' from 'jinja2' 问题解决办法

简介: cannot import name 'environmentfilter' from 'jinja2' 问题解决办法

1.cannot import name 'environmentfilter' from 'jinja2'


(p2) PS E:\08.paddle\PaddleScience-develop\docs> .\make.bat
Traceback (most recent call last):
  File "C:\miniconda3\envs\p2\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\miniconda3\envs\p2\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\miniconda3\envs\p2\Scripts\sphinx-build.exe\__main__.py", line 4, in <module>
  File "C:\miniconda3\envs\p2\lib\site-packages\sphinx\cmd\build.py", line 25, in <module>
    from sphinx.application import Sphinx
  File "C:\miniconda3\envs\p2\lib\site-packages\sphinx\application.py", line 43, in <module>
    from sphinx.registry import SphinxComponentRegistry
  File "C:\miniconda3\envs\p2\lib\site-packages\sphinx\registry.py", line 24, in <module>
    from sphinx.builders import Builder
  File "C:\miniconda3\envs\p2\lib\site-packages\sphinx\builders\__init__.py", line 26, in <module>
    from sphinx.util import import_object, logging, progress_message, rst, status_iterator
  File "C:\miniconda3\envs\p2\lib\site-packages\sphinx\util\rst.py", line 21, in <module>
    from jinja2 import Environment, environmentfilter
ImportError: cannot import name 'environmentfilter' from 'jinja2' (C:\miniconda3\envs\p2\lib\site-packages\jinja2\__init__.py)
(p2) PS E:\08.paddle\PaddleScience-develop\docs>

感觉好纳闷啊啊啊,通过百度,据悉是jinja2版本过高,哭晕了。

pip list发现 jinja2版本为3.1.2

Jinja2                        3.1.2

于是乎降级先

pip install jinja2==2.10.1


2.ImportError: cannot import name 'soft_unicode' from 'markupsafe'


结果继续报错

(p2) PS E:\08.paddle\PaddleScience-develop\docs> .\make.bat
Traceback (most recent call last):
  File "C:\miniconda3\envs\p2\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\miniconda3\envs\p2\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\miniconda3\envs\p2\Scripts\sphinx-build.exe\__main__.py", line 4, in <module>
  File "C:\miniconda3\envs\p2\lib\site-packages\sphinx\cmd\build.py", line 25, in <module>
    from sphinx.application import Sphinx
  File "C:\miniconda3\envs\p2\lib\site-packages\sphinx\application.py", line 32, in <module>
    from sphinx.config import Config
  File "C:\miniconda3\envs\p2\lib\site-packages\sphinx\config.py", line 27, in <module>
    from sphinx.util.tags import Tags
  File "C:\miniconda3\envs\p2\lib\site-packages\sphinx\util\tags.py", line 11, in <module>
    from jinja2 import nodes
  File "C:\miniconda3\envs\p2\lib\site-packages\jinja2\__init__.py", line 33, in <module>
    from jinja2.environment import Environment, Template
  File "C:\miniconda3\envs\p2\lib\site-packages\jinja2\environment.py", line 15, in <module>
    from jinja2 import nodes
  File "C:\miniconda3\envs\p2\lib\site-packages\jinja2\nodes.py", line 19, in <module>
    from jinja2.utils import Markup
  File "C:\miniconda3\envs\p2\lib\site-packages\jinja2\utils.py", line 647, in <module>
    from markupsafe import Markup, escape, soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (C:\miniconda3\envs\p2\lib\site-packages\markupsafe\__init__.py)

继续降级

pip install markupsafe==1.1.1


目录
相关文章
|
6月前
|
数据可视化 数据挖掘 开发者
import有什么用,python中怎么使用import
import有什么用,python中怎么使用import
70 1
|
Python
python flask 后端报错 ImportError: cannot import name ‘cached_prope‘
问题python flask 后端报错 ImportError: cannot import name ‘cached_prope‘flask程序启动但抛出该错误,是因为werkzeug 版本过高,需要降低版本即可 解决:一般这种情况是需要注意第三方库版本的对应,werkzeug需要0.16.0 版本时 flask的版本应该时1.x.x 的版本,不能是2.x过高的版本。
174 0
|
5月前
|
XML 数据格式 Python
在Python中,导入其他模块是通过使用import语句完成的
在Python中导入模块涉及`import`语句的不同用法:1) `import math`导入整个标准库;2) `from math import sqrt`导入单个函数;3) `import numpy as np`使用别名;4) `from random import *`导入所有(不推荐);5) `import xml.etree.ElementTree as ET`导入子模块;6) 使用`importlib.import_module()`延迟导入;7) `from .module import func`导入相对路径模块,需管理`sys.path`。
89 6
|
Python
Flask开发 导入flask_uploads包时提示“IMPORTERROR: CANNOT IMPORT NAME ‘SECURE_FILENAME‘ FROM ‘WERKZEUG‘“
在使用Flask开发过程中,使用Flask_uploads模块开发上传文件功能时,在项目中导入该包时,提示“ImportError: cannot import name ‘secure_filename’ from 'werkzeug”错误。
583 0
Flask开发 导入flask_uploads包时提示“IMPORTERROR: CANNOT IMPORT NAME ‘SECURE_FILENAME‘ FROM ‘WERKZEUG‘“
|
Python
flask开发导入flask_uploads包时提示"ImportError: cannot import name 'secure_filename' from 'werkzeug'"
在使用Flask开发过程中,使用Flask_uploads模块开发上传文件功能时,在项目中导入该包时,提示“ImportError: cannot import name ‘secure_filename’ from 'werkzeug”错误。
311 0
|
JSON 缓存 Serverless
23.从入门到精通:Python模块 import 语句 from … import 语句 from … import * 语句 深入模块 修改my_module的源代码
23.从入门到精通:Python模块 import 语句 from … import 语句 from … import * 语句 深入模块 修改my_module的源代码
【Python】深究模块导入:from .. import ..\ import ..
【Python】深究模块导入:from .. import ..\ import ..
|
Python
python使用import引用不了configparse模块等问题解决办法
python使用import引用不了configparse模块等问题解决办法
184 0
|
Web App开发 JavaScript 前端开发
selenium源码通读 | common/exceptions.py异常类
selenium源码通读 | common/exceptions.py异常类
95 0