尝试在 Mac 上安装 apache-airflow 时出错。我怎样才能解决这个问题?

Posted

技术标签:

【中文标题】尝试在 Mac 上安装 apache-airflow 时出错。我怎样才能解决这个问题?【英文标题】:Getting error when trying to install apache-airflow on Mac. How can I fix this? 【发布时间】:2019-06-22 01:14:12 【问题描述】:

下面的错误输出:

ronakvora:dtc ronakvora$ pip install apache-airflow
  Installing build dependencies ... done
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/pendulum.egg-info
    writing requirements to pip-egg-info/pendulum.egg-info/requires.txt
    writing pip-egg-info/pendulum.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/pendulum.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/pendulum.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/pendulum.egg-info/SOURCES.txt'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/6x/xsb52c7936l38mmb9f7s268m0000gn/T/pip-install-WFGcOd/pendulum/setup.py", line 50, in <module>
        setup(**setup_kwargs)
      File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/private/var/folders/6x/xsb52c7936l38mmb9f7s268m0000gn/T/pip-build-env-HZt1xp/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 296, in run
        self.find_sources()
      File "/private/var/folders/6x/xsb52c7936l38mmb9f7s268m0000gn/T/pip-build-env-HZt1xp/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 303, in find_sources
        mm.run()
      File "/private/var/folders/6x/xsb52c7936l38mmb9f7s268m0000gn/T/pip-build-env-HZt1xp/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 534, in run
        self.add_defaults()
      File "/private/var/folders/6x/xsb52c7936l38mmb9f7s268m0000gn/T/pip-build-env-HZt1xp/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 570, in add_defaults
        sdist.add_defaults(self)
      File "/private/var/folders/6x/xsb52c7936l38mmb9f7s268m0000gn/T/pip-build-env-HZt1xp/lib/python2.7/site-packages/setuptools/command/py36compat.py", line 36, in add_defaults
        self._add_defaults_ext()
      File "/private/var/folders/6x/xsb52c7936l38mmb9f7s268m0000gn/T/pip-build-env-HZt1xp/lib/python2.7/site-packages/setuptools/command/py36compat.py", line 119, in _add_defaults_ext
        build_ext = self.get_finalized_command('build_ext')
      File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
        self.finalize_options()
      File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_ext.py", line 159, in finalize_options
        self.include_dirs.append(py_include)
    AttributeError: 'unicode' object has no attribute 'append'

----------------------------------------

命令“python setup.py egg_info”失败,错误代码 1 在 /private/var/folders/6x/xsb52c7936l38mmb9f7s268m0000gn/T/pip-install-WFGcOd/pendulum/ 您使用的是 pip 版本 18.1,但版本 19.0.1 可用。 您应该考虑通过“pip install --upgrade pip”命令进行升级。

【问题讨论】:

【参考方案1】:

我最近在Airflow 1.10.2 上遇到了类似的错误,就我而言,它与pendulum 的错误版本有关

运行pip show pendulum

名称:钟摆

版本:1.4.4

总结:Python 日期时间变得简单。

...

如果您的pendulum 版本与v1.4.4 不同,请执行强制重新安装 (Airflow 1.10.2requires pendulum===1.4.4)

pip install --force-reinstall pendulum===1.4.4


参考文献

Find which version of package is installed with pip Installing specific package versions with pip

【讨论】:

【参考方案2】:

我并没有完全解决上面的问题,只是决定切换到python3并使用pip3 install apache-airflow。

【讨论】:

哦对了,忘了说我在Python 3.6.6

以上是关于尝试在 Mac 上安装 apache-airflow 时出错。我怎样才能解决这个问题?的主要内容,如果未能解决你的问题,请参考以下文章

在Mac上安装PyDrive

尝试使用“pip install psycopg2”在 Mac 上安装 psycopg2 时出现权限错误

尝试在 Mac 上使用 Python3 安装 MetaTrader5

尝试在 Mac 上安装 apache-airflow 时出错。我怎样才能解决这个问题?

尝试在 Mac (Mavericks) 上安装 lxml 以在 Django 1.5 中使用时出错

尝试在 mac 上安装 sqlite3“sudo gem install sqlite3”时出错