Airflow无法导入Airflow.providers文件

2024-10-01 07:41:12 发布

您现在位置:Python中文网/ 问答频道 /正文

Im想要导入Google提供商。所以我安装了它

pip3 install apache-airflow-backport-providers-google

我可以看到所有的钩子和包目录下的一切

/usr/local/lib/python3.7/dist-packages/airflow/providers/google/cloud/transfer

但是当我运行import命令时,它失败了

from airflow.providers.google.cloud.transfers.sql_to_gcs import BaseSQLToGCSOperator


Error:
Traceback (most recent call last):
  File "test1.py", line 8, in <module>
    from custom.custom_PostgresToGCSOperator import custom_PostgresToGCSOperator
  File "/root/airflow/dags/custom/custom_PostgresToGCSOperator.py", line 8, in <module>
    from airflow.providers.google.cloud.transfers.sql_to_gcs import BaseSQLToGCSOperator
ModuleNotFoundError: No module named 'airflow.providers'

Tags: tofromimportcloudsqlcustomgoogletransfers