【发布时间】:2014-11-03 09:15:15
【问题描述】:
通过 setuptools 安装 numpy + pandas 作为 setup.py 中的依赖项对我不起作用。这与缺少依赖关系无关。如果我通过pip install numpy 安装numpy,然后python setup.py develop 一切正常。如果我正确理解setuptools 文档,则所有软件包都是先构建然后安装的。因此,numpy 已构建,但在 pandas 构建时未安装。
作为一种解决方法,我将numpy 添加到我的setup_requires。这很好用,但显然不是一个非常干净的解决方案。
有人知道通过 setuptools 安装 numpy + pandas 的干净解决方案(仅限 Linux 即可)吗?
更新:
依赖配置通过
install_requires=['numpy','pandas']
无论我是显式添加 numpy 还是只添加 pandas,都没有区别。在这两种情况下,都会下载并构建 numpy,但 pandas 无法构建,因为找不到某些标头(可能是在 numpy 的安装步骤中安装的,但不是在构建时安装的)。如果我先安装 numpy,一切正常。我可以 100% 重现这一点,并且独立于我正在从事的项目。
更新 2:
这是堆栈跟踪的结尾:
File "/tmp/easy_install-QMa4ce/pandas-0.14.1/temp/easy_install-f6lreI/numpy-1.9.0/numpy/distutils/command/build_src.py", line 153, in run
File "/tmp/easy_install-QMa4ce/pandas-0.14.1/temp/easy_install-f6lreI/numpy-1.9.0/numpy/distutils/command/build_src.py", line 170, in build_sources
File "/tmp/easy_install-QMa4ce/pandas-0.14.1/temp/easy_install-f6lreI/numpy-1.9.0/numpy/distutils/command/build_src.py", line 329, in build_extension_sources
File "/tmp/easy_install-QMa4ce/pandas-0.14.1/temp/easy_install-f6lreI/numpy-1.9.0/numpy/distutils/command/build_src.py", line 386, in generate_sources
File "numpy/core/setup.py", line 432, in generate_config_h
File "numpy/core/setup.py", line 42, in check_types
entry_points={
File "numpy/core/setup.py", line 293, in check_types
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
最后的信息肯定是错误的。如果我在运行python setup.py develop 之前执行pip install numpy 一切正常。在上面的例子中,我在install_requires 中只有pandas,没有numpy。但据我所知,numpy 是否显式添加没有区别。
【问题讨论】:
-
您如何将其声明为依赖 atm? (不工作的方式。)
标签: python numpy pandas setuptools