我是Airflow的新手。我按照此处显示的说明进行操作:https://www.youtube.com/watch?v=SYOUbiGtGiU&t=49s
第1步:控制面板|程序和功能|打开或关闭Windows功能
启用:适用于Linux的Windows子系统
第2步:从Windows存储安装Ubuntu并重新启动系统
第3步:安装和更新PIP
sudo apt-get install software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install python-pip
第4步:安装气流
export SLUGIFY_USES_TEXT_UNIDECODE=yes
pip install apache-airflow
第5步:初始化数据库
airflow initdb
那之后我得到一个错误:
[2019-09-30 17:46:37,888] {__init__.py:51} INFO - Using executor SequentialExecutor
Traceback (most recent call last):
File "/usr/local/bin/airflow", line 22, in <module>
from airflow.bin.cli import CLIFactory
File "/usr/local/lib/python2.7/dist-packages/airflow/bin/cli.py", line 68, in <module>
from airflow.www_rbac.app import cached_app as cached_app_rbac
File "/usr/local/lib/python2.7/dist-packages/airflow/www_rbac/app.py", line 26, in <module>
from flask_appbuilder import AppBuilder, SQLA
File "/home/barys_rutman/.local/lib/python2.7/site-packages/flask_appbuilder/__init__.py", line 5, in <module>
from .base import AppBuilder
File "/home/barys_rutman/.local/lib/python2.7/site-packages/flask_appbuilder/base.py", line 5, in <module>
from .api.manager import OpenApiManager
File "/home/barys_rutman/.local/lib/python2.7/site-packages/flask_appbuilder/api/__init__.py", line 11, in <module>
from marshmallow_sqlalchemy.fields import Related, RelatedList
File "/home/barys_rutman/.local/lib/python2.7/site-packages/marshmallow_sqlalchemy/__init__.py", line 1, in <module>
from .schema import TableSchemaOpts, ModelSchemaOpts, TableSchema, ModelSchema
File "/home/barys_rutman/.local/lib/python2.7/site-packages/marshmallow_sqlalchemy/schema.py", line 101
class TableSchema(ma.Schema, metaclass=TableSchemaMeta):
^
SyntaxError: invalid syntax
有什么解决办法吗?
答案 0 :(得分:2)
有两种方法可以解决这个问题,我认为最简单的方法是切换到 Python 3 (也是推荐的方法,因为时间不长 Python 2 的运行速度很低:Python 2.7 Countdown)。
修改您的一些设置步骤(我必须说这些是盲目的步骤,因为我没有对其进行测试):
安装 Python 3 (如果尚未安装)
sudo apt-get install python3
安装/升级 pip3
sudo apt-get install python3-pip
使用 pip3 安装软件包
pip3 install apache-airflow
将 / usr / bin / python 可执行文件(由 AirFlow 使用)修改为 python3 <的符号链接 / em>(先备份)
sudo mv /usr/bin/python /usr/bin/python.orig
sudo ln -s python3 /usr/bin/python
继续执行其余步骤