美文网首页
遇到ImportError: cannot import nam

遇到ImportError: cannot import nam

作者: WMSmile | 来源:发表于2022-04-26 17:22 被阅读0次

    遇到ImportError: cannot import name ‘soft_unicode’ from 'markupsafe’问题

    弃用警告:“soft_unicode”已重命名为“soft_str”.旧名称将在 MarkupSafe 2.1 中删除. - 无论代码示例

    File "/Users/apple/Desktop/workspace/python/admin/venv/bin/superset", line 33, in <module>
        sys.exit(load_entry_point('apache-superset==1.4.2', 'console_scripts', 'superset')())
      File "/Users/apple/Desktop/workspace/python/admin/venv/bin/superset", line 25, in importlib_load_entry_point
        return next(matches).load()
      File "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 77, in load
        module = import_module(match.group('module'))
      File "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
      File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 850, in exec_module
      File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
      File "/Users/apple/Desktop/workspace/python/admin/venv/lib/python3.9/site-packages/superset/__init__.py", line 18, in <module>
        from flask import current_app, Flask
      File "/Users/apple/Desktop/workspace/python/admin/venv/lib/python3.9/site-packages/flask/__init__.py", line 14, in <module>
        from jinja2 import escape
      File "/Users/apple/Desktop/workspace/python/admin/venv/lib/python3.9/site-packages/jinja2/__init__.py", line 12, in <module>
        from .environment import Environment
      File "/Users/apple/Desktop/workspace/python/admin/venv/lib/python3.9/site-packages/jinja2/environment.py", line 25, in <module>
        from .defaults import BLOCK_END_STRING
      File "/Users/apple/Desktop/workspace/python/admin/venv/lib/python3.9/site-packages/jinja2/defaults.py", line 3, in <module>
        from .filters import FILTERS as DEFAULT_FILTERS  # noqa: F401
      File "/Users/apple/Desktop/workspace/python/admin/venv/lib/python3.9/site-packages/jinja2/filters.py", line 13, in <module>
        from markupsafe import soft_unicode
    ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/Users/apple/Desktop/workspace/python/admin/venv/lib/python3.9/site-packages/markupsafe/__init__.py)
    

    由于 markupsafe 弃用警告:“soft_unicode”已重命名为“soft_str”.旧名称将在 MarkupSafe 2.1 中删除.

    只能安装2.1下版本

    pip install markupsafe==2.0.1
    

    相关文章

      网友评论

          本文标题:遇到ImportError: cannot import nam

          本文链接:https://www.haomeiwen.com/subject/kejlyrtx.html