Apache Airflow:气流initdb导致“ImportError:没有名为json的模块”




python-2.7 ubuntu-16.04 (2)

在Ubuntu 16.04上使用Python 2.7默认版本,我试图安装Apache气流但遇到了几个问题,目前我看到了

apache initdb 
Traceback (most recent call last):
  File "/usr/local/bin/airflow", line 21, in <module>
    from airflow import configuration
  File "/usr/local/lib/python2.7/dist-packages/airflow/__init__.py", line 40, in <module>
    from flask_admin import BaseView
  File "/usr/local/lib/python2.7/dist-packages/flask_admin/__init__.py", line 6, in <module>
    from .base import expose, expose_plugview, Admin, BaseView, AdminIndexView  # noqa: F401
  File "/usr/local/lib/python2.7/dist-packages/flask_admin/base.py", line 6, in <module>
    from flask import Blueprint, current_app, render_template, abort, g, url_for
  File "/usr/local/lib/python2.7/dist-packages/flask/__init__.py", line 20, in <module>
    from .app import Flask
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 69, in <module>
    from .wrappers import Request
  File "/usr/local/lib/python2.7/dist-packages/flask/wrappers.py", line 14, in <module>
    from werkzeug.wrappers.json import JSONMixin as _JSONMixin
ImportError: No module named json

到目前为止尝试过这些事情:


$ sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev
sudo pip install -U Werkzeug==0.14.1

sudo pip install -U Jinja2==2.10.1

也试过了

pip install jsonate

pip install json # (this did not work)
 python
Python 2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> exit()

到目前为止没有任何工作。


只需升级烧瓶。 您可以使用此命令:

pip install --upgrade Flask


在Mac上安装apache-airflow时,出现以下错误:

错误:apache-airflow 1.10.3要求jinja2 <= 2.10.0,> = 2.7.3,但你将拥有不兼容的jinja2 2.10.1。 错误:apache-airflow 1.10.3要求werkzeug <0.15.0,> = 0.14.1,但你会有werkzeug 0.15.4这是不相容的。

重新安装werkzeug和jinja为我工作。

pip install jinja2>=2.10.0
pip install werkzeug>=0.15.0