您应该使用setup_requires
参数来setup()
. 从文档中,
setup_requires
一个字符串或字符串列表,指定需要存在哪些其他发行版才能运行安装脚本。setuptools 将在处理其余的设置脚本或命令之前尝试获取这些(甚至使用 EasyInstall 下载它们)。如果您在构建过程中使用 distutils 扩展,则需要此参数;例如,处理 setup() 参数并将它们转换为 EGG-INFO 元数据文件的扩展。
(注意:setup_requires 中列出的项目不会自动安装在运行安装脚本的系统上。如果它们在本地不可用,它们只需下载到 ./.eggs 目录。如果您希望安装它们,以及在运行安装脚本时可用,您应该将它们添加到 install_requires 和 setup_requires。)
https://pythonhosted.org/setuptools/setuptools.html#new-and-changed-setup-keywords
编辑:它应该为中的每个条目创建一个 egg 目录setup_requires
。但是,我只是尝试了反弹,它实际上无法在易于安装的情况下构建。
$> python2 setup.py install
install_dir .
warning: no files found matching 'src/rebound.h'
src/rebound.c:38:21: fatal error: rebound.h: No such file or directory
compilation terminated.
Traceback (most recent call last):
File "setup.py", line 187, in <module>
url="http://www.mathics.github.io/", # project home page, if any
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/setuptools/dist.py", line 221, in __init__
self.fetch_build_eggs(attrs.pop('setup_requires'))
File "/usr/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/setuptools/dist.py", line 245, in fetch_build_eggs
parse_requirements(requires), installer=self.fetch_build_egg
File "/usr/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 544, in resolve
dist = best[req.key] = env.best_match(req, self, installer)
File "/usr/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 786, in best_match
return self.obtain(req, installer) # try and download/install
File "/usr/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 798, in obtain
return installer(requirement)
File "/usr/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/setuptools/dist.py", line 293, in fetch_build_egg
return cmd.easy_install(req)
File "/usr/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/setuptools/command/easy_install.py", line 582, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/setuptools/command/easy_install.py", line 612, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/setuptools/command/easy_install.py", line 802, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/setuptools/command/easy_install.py", line 1079, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/setuptools/command/easy_install.py", line 1070, in run_setup
raise DistutilsError("Setup script exited with %s" % (v.args[0],))
distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1