gpt4 book ai didi

python - 在 Raspberry Pi 上安装 Airflow 时找不到 BashOperator

转载 作者:行者123 更新时间:2023-12-05 01:09:15 25 4
gpt4 key购买 nike

我不知道如何解决这个问题——与 ModuleNotFoundError 相关的其他帖子可以通过重新安装相关包来解决,但很明显这不是问题,因为示例 bash 运算符DAG 运行。那么我的问题与 Airflow 的安装方式有关吗?此时我正在考虑通过 puckel Docker container 重新安装 Airflow .

[2020-12-23 01:02:24,705] {dagbag.py:259} ERROR - Failed to import: /home/pi/airflow/dags/dag_clist.py

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/airflow/models/dagbag.py", line 256, in process_file
m = imp.load_source(mod_name, filepath)
File "/usr/lib/python3.7/imp.py", line 171, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 696, in _load
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/pi/airflow/dags/dag_clist.py", line 7, in <module>
from airflow.operators.bash import BashOperator
ModuleNotFoundError: No module named 'airflow.operators.bash'

与 BashOperator 相关的其他 SO 帖子:

最佳答案

由于您使用的是 Airflow 1.10.14,因此导入应该是

from airflow.operators.bash_operator import BashOperator

在 Airflow >= 2.0.0 中是:

from airflow.operators.bash import BashOperator

关于python - 在 Raspberry Pi 上安装 Airflow 时找不到 BashOperator,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65419191/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com