ImportError:没有名为api_core.exceptions的模块

时间:2019-04-30 06:58:14

标签: python airflow

我想对我的项目运行google.cloud.storage依赖项,所以我尝试使用

安装此依赖项

sudo pip install --upgrade google-api-python-client

运行上述命令,我们将所有必需的软件包安装在apache airflow dist-packages 目录中,例如:- /usr/local/python2.7/dist-packages /

当我使用以下代码将库导入到项目中时。

from airflow.contrib.operators.mysql_to_gcs import MySqlToGoogleCloudStorageOperator

在pyhton上运行项目,出现错误ImportError: No module named api_core.exceptions

这是痕迹

#python mysql_to_gcs.py
[2019-04-30 06:45:09,668] {settings.py:182} INFO - settings.configure_orm(): Using pool settings. pool_size=5, pool_recycle=1800, pid=15440
Traceback (most recent call last):
  File "mysql_to_gcs.py", line 2, in <module>
    from airflow.contrib.operators.mysql_to_gcs import MySqlToGoogleCloudStorageOperator
  File "/usr/local/lib/python2.7/dist-packages/airflow/contrib/operators/mysql_to_gcs.py", line 25, in <module>
    from airflow.contrib.hooks.gcs_hook import GoogleCloudStorageHook
  File "/usr/local/lib/python2.7/dist-packages/airflow/contrib/hooks/gcs_hook.py", line 25, in <module>
    from airflow.contrib.hooks.gcp_api_base_hook import GoogleCloudBaseHook
  File "/usr/local/lib/python2.7/dist-packages/airflow/contrib/hooks/gcp_api_base_hook.py", line 30, in <module>
    from google.api_core.exceptions import GoogleAPICallError, AlreadyExists, RetryError
ImportError: No module named api_core.exceptions


1 个答案:

答案 0 :(得分:1)

代替--upgrade google-api-python-client,只需使用
重新安装api-core pip install dialogflow

升级存在一些无法更新api-core的怪异问题。