D:\anaconda\Lib\site-packages\flask\templating.py:146: AttributeError
时间: 2024-04-13 11:24:02 浏览: 157
D:\anaconda\Lib\site-packages\flask\templating.py:146: AttributeError 是一个错误提示,它表示在 Flask 框架的 templating.py 文件的第 146 行发生了 AttributeError 错误。AttributeError 错误通常是由于访问了一个不存在的属性或方法导致的。
要解决这个错误,可以按照以下步骤进行排查:
1. 检查代码:查看你的代码中是否有对 flask.templating 模块的调用,并确保在调用之前已经正确导入了该模块。
2. 检查属性:检查你在代码中使用的属性或方法是否存在拼写错误或者是否存在于该模块中。
3. 检查版本:确保你使用的 Flask 版本与你的代码兼容,并且没有发生版本不匹配导致的错误。
如果以上步骤都没有解决问题,可以提供更多的错误信息和相关代码,以便我能够更准确地帮助你解决问题。
相关问题
Collecting face_recognition Using cached face_recognition-1.3.0-py2.py3-none-any.whl (15 kB) Requirement already satisfied: Pillow in d:\anaconda\envs\pytorch\lib\site-packages (from face_recognition) (9.4.0) Requirement already satisfied: face-recognition-models>=0.3.0 in d:\anaconda\envs\pytorch\lib\site-packages (from face_recognition) (0.3.0) Collecting dlib>=19.7 Using cached dlib-19.24.1.tar.gz (3.2 MB) Preparing metadata (setup.py) ... done Requirement already satisfied: Click>=6.0 in d:\anaconda\envs\pytorch\lib\site-packages (from face_recognition) (8.1.3) Requirement already satisfied: numpy in d:\anaconda\envs\pytorch\lib\site-packages (from face_recognition) (1.24.2) Requirement already satisfied: colorama in d:\anaconda\envs\pytorch\lib\site-packages (from Click>=6.0->face_recognition) (0.4.6) Building wheels for collected packages: dlib Building wheel for dlib (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [7 lines of output] running bdist_wheel running build running build_py running build_ext ERROR: CMake must be installed to build dlib [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for dlib Running setup.py clean for dlib Failed to build dlib Installing collected packages: dlib, face_recognition Running setup.py install for dlib ... error error: subprocess-exited-with-error × Running setup.py install for dlib did not run successfully. │ exit code: 1 ╰─> [9 lines of output] running install D:\anaconda\envs\pytorch\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( running build running build_py running build_ext ERROR: CMake must be installed to build dlib [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure × Encountered error while trying to install package. ╰─> dlib note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.
这是一个安装dlib和face_recognition库时遇到的错误。根据错误输出,需要安装CMake才能构建dlib。你可以尝试通过以下命令安装CMake:
```
pip install cmake
```
然后再重新安装dlib和face_recognition库即可。
cmd 打开jupyter notebook 报错:Traceback (most recent call last): File "D:\anaconda\Scripts\jupyter-notebook-script.py", line 6, in <module> from notebook.notebookapp import main File "D:\anaconda\lib\site-packages\notebook\notebookapp.py", line 41, in <module> from jinja2 import Environment, FileSystemLoader File "D:\anaconda\lib\site-packages\jinja2\__init__.py", line 33, in <module> from jinja2.environment import Environment, Template File "D:\anaconda\lib\site-packages\jinja2\environment.py", line 15, in <module> from jinja2 import nodes File "D:\anaconda\lib\site-packages\jinja2\nodes.py", line 19, in <module> from jinja2.utils import Markup File "D:\anaconda\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' (D:\anaconda\lib\site-packages\markupsafe\__init__.py)
这个问题通常发生在更新了 anaconda 或者 jupyter notebook 后出现,可能是因为 jinja2 与 markupsafe 版本不兼容所致。你可以尝试升级 markupsafe,或者降级 jinja2 版本,具体步骤如下:
1. 在命令行中输入以下命令更新 markupsafe:`pip install --upgrade markupsafe`
2. 如果更新 markupsafe 无法解决问题,你可以尝试降级 jinja2 版本,命令如下:`pip install jinja2==2.10.1`
如果以上两种方法均不能解决问题,你可以尝试重新安装 anaconda 或 jupyter notebook。
阅读全文