Python:从其他地方导入?

时间:2016-06-08 17:31:01

标签: python airflow

bash-4.1$ airflow initdb
Traceback (most recent call last):
  File "/u/bin/airflow", line 4, in <module>
    from airflow import configuration
  File "/u/lib/python2.7/site-packages/airflow/__init__.py", line 31, in <module>
    from airflow.models import DAG
  File "/u/lib/python2.7/site-packages/airflow/models.py", line 53, in <module>
    from croniter import croniter
  File "/u/lib/python2.7/site-packages/croniter/__init__.py", line 3, in <module>
    from .croniter import croniter
  File "/u/lib/python2.7/site-packages/croniter/croniter.py", line 8, in <module>
    from dateutil.relativedelta import relativedelta
  File "build/bdist.linux-x86_64/egg/dateutil/relativedelta.py", line 5, in <module>
ImportError: cannot import name integer_types

但口译员没有问题:

bash-4.1$ /u/bin/python2.7
Python 2.7.5 (default, Oct 17 2013, 14:04:34) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import croniter
>>> 

我假设它必须做一些事情:

File "build/bdist.linux-x86_64/egg/dateutil/relativedelta.py", line 5, in <module>

因此,在翻译中,它使用dateutil中的/u/lib/python2.7,而在气流中,它使用来自datutil的{​​{1}} ??

我甚至不知道build/bdist.linux-x86_64/egg/dateutil在哪里。

有人可以告诉我发生了什么以及如何告诉气流从正确的build/bdist.linux-x86_64/egg/dateutil导入?

1 个答案:

答案 0 :(得分:4)

您需要安装Six python包。

只需制作pip install six