在iMac上安装Apache Airflow-Airflow initdb-ImportError:无法导入名称对象

在iMac上安装Apache Airflow-Airflow initdb-ImportError:无法导入名称对象,airflow,Airflow,我试图在iMac上安装airflow airflow initdb 我犯了这个错误 Traceback (most recent call last): File "/Users/admin/anaconda/bin/airflow", line 21, in <module> from airflow import configuration File "/Users/admin/anaconda/lib/python2.7/site-packages

我试图在iMac上安装airflow

airflow initdb
我犯了这个错误

Traceback (most recent call last):
    File "/Users/admin/anaconda/bin/airflow", line 21, in <module>
      from airflow import configuration
    File "/Users/admin/anaconda/lib/python2.7/site-packages/airflow/__init__.py", line 37, in <module>
      from airflow.models import DAG
    File "/Users/admin/anaconda/lib/python2.7/site-packages/airflow/models.py", line 32, in <module>
      import dill
    File "/Users/admin/anaconda/lib/python2.7/site-packages/dill/__init__.py", line 60, in <module>
      from . import objtypes as types
    File "/Users/admin/anaconda/lib/python2.7/site-packages/dill/objtypes.py", line 16, in <module>
      from dill import objects
    ImportError: cannot import name objects

但是当我运行initdb时仍然会遇到相同的错误。

您可能需要检查系统上安装的dill版本。0.2a1之前的版本(特别是0.1a1版本)不包含“对象”,并且会抛出您在上面看到的错误

我在mac上创建了一个测试conda环境,并通过pip安装尝试了不同版本的dill的失败导入

dill版本0.1a1的结果:

(dill_test) pip install dill==0.1a1
Collecting dill==0.1a1
Installing collected packages: dill
Successfully installed dill-0.1a1
(dill_test)  python
Python 2.7.15 |Anaconda, Inc.| (default, Dec 14 2018, 13:10:39)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
>>> from dill import objects
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name objects

这可能是因为您使用的是anaconda,并且包
dill
与Python版本不同吗?谢谢。这是迪尔发行的版本。在另一台Mac上,我有更新的anaconda,我没有这个错误。数据库工作正常。我将尝试更新anaconda,看看它是否能解决问题,但是当我尝试在一个新的环境(Python3)上进行fresh安装时,我仍然在运行initdb时出错。我会用另一种方式问它。
(dill_test) pip install dill==0.1a1
Collecting dill==0.1a1
Installing collected packages: dill
Successfully installed dill-0.1a1
(dill_test)  python
Python 2.7.15 |Anaconda, Inc.| (default, Dec 14 2018, 13:10:39)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
>>> from dill import objects
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name objects
(dill_test) pip uninstall dill
Uninstalling dill-0.1a1:
  Would remove:
    /Users/.../anaconda2/envs/dill_test/lib/python2.7/site-packages/dill-    0.1a1.dist-info/*
    /Users/.../anaconda2/envs/dill_test/lib/python2.7/site-packages/dill/*
Proceed (y/n)? y
  Successfully uninstalled dill-0.1a1
(dill_test) pip install dill==0.2a1
Collecting dill==0.2a1
Installing collected packages: dill
Successfully installed dill-0.2a1
(dill_test) python
Python 2.7.15 |Anaconda, Inc.| (default, Dec 14 2018, 13:10:39)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
>>> from dill import objects
>>>