启动Airflow Webserver时:ImportError:无法导入名称EscapeFormatter

时间:2018-08-24 06:11:53

标签: python-2.7 airflow

启动Webserver时,在安装Airflow之后收到此错误。 下面是错误,

/usr/lib64/python2.7/site-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.cache is deprecated, use flask_cache instead.
.format(x=modname), ExtDeprecationWarning
Traceback (most recent call last):
File "/usr/bin/airflow", line 27, in 
args.func(args)
File "/usr/lib/python2.7/site-packages/airflow/bin/cli.py", line 678, in webserver
app = cached_app(conf)
File "/usr/lib/python2.7/site-packages/airflow/www/app.py", line 161, in cached_app
app = create_app(config)
File "/usr/lib/python2.7/site-packages/airflow/www/app.py", line 59, in create_app
from airflow.www import views
File "/usr/lib/python2.7/site-packages/airflow/www/views.py", line 49, in 
from jinja2.sandbox import ImmutableSandboxedEnvironment
File "/usr/lib64/python2.7/site-packages/jinja2/sandbox.py", line 25, in 
**from markupsafe import EscapeFormatter
ImportError: cannot import name EscapeFormatter**

1 个答案:

答案 0 :(得分:2)

解决方法: 似乎是与python软件包相关的问题,请尝试检查软件包markupsafe是否位于路径/usr/lib64/python2.7/site-packages/

它确实存在,因此尝试将其导入为from markupsafe import EscapeFormatter in python shell,但同时也给出了相同的错误。可能是文件已损坏。

重新安装软件包并再次导入对我有帮助。

sudo pip uninstall markupsafe
sudo pip install markupsafe

此后,从markupsafe导入EscapeFormatter在python shell中运行良好。

现在启动Airflow Web服务器,它可以正常工作:airflow webserver -p 8080