尝试在本地安装 AirFlow 的问题

Issues trying to install AirFlow locally

我是 airflow 的新手,我正在尝试按照下面 link 上的说明在本地安装: https://airflow.apache.org/docs/apache-airflow/stable/start/local.html

我是运行这段代码(如上link所述):

# Airflow needs a home. `~/airflow` is the default, but you can put it
# somewhere else if you prefer (optional)
export AIRFLOW_HOME=~/airflow

# Install Airflow using the constraints file
AIRFLOW_VERSION=2.2.5
PYTHON_VERSION="$(python --version | cut -d " " -f 2 | cut -d "." -f 1-2)"
# For example: 3.6
CONSTRAINT_URL="https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PYTHON_VERSION}.txt"
# For example: https://raw.githubusercontent.com/apache/airflow/constraints-2.2.5/constraints-3.6.txt
pip install "apache-airflow==${AIRFLOW_VERSION}" --constraint "${CONSTRAINT_URL}"

# The Standalone command will initialise the database, make a user,
# and start all components for you.
airflow standalone

# Visit localhost:8080 in the browser and use the admin account details
# shown on the terminal to login.
# Enable the example_bash_operator dag in the home page

并出现此错误:

File "C:\Users\F43555~1\AppData\Local\Temp/ipykernel_12908/3415008398.py", line 3
    export AIRFLOW_HOME=~/airflow
           ^
SyntaxError: invalid syntax

有人知道怎么处理吗?

我 运行 在 windows 10,vs code (jupyter notebook)。

谢谢!

Airflow 仅在 Linux 上受支持,您似乎正尝试在 windows 机器上 运行 此操作。

如果您想在 Windows 上安装 Airflow,您需要为 Linux (WSL) 或 Docker 使用 Windows 子系统之类的东西。有一些示例可以向您展示如何在 WSL 上执行此操作(以及使用 docker 加载)- Here is one of them with WSL.