问题描述
我有一个 Python 包,它的 setup.py 具有通过通常方式在 install_requires=[...] 中声明的依赖项.那里的一个包 scikits.timeseries 有一个 setup.py 期望已经安装了 numpy,因此,我想要一些方法来首先安装 numpy.对于这种情况和一般情况,可以控制依赖安装的顺序吗?如何?
I've got a Python package with its setup.py having dependencies declared via the usual way, in install_requires=[...]. One of the packages there, scikits.timeseries, has a setup.py expecting numpy to already be installed, thus, I'd like some way to have numpy installed first. For this case and in general, can the order of dependency installation be controlled? How?
目前 setup.py 下拉依赖项的顺序(如 arg install_requires 中列出的)实际上是随机的.另外,在 setup.py setup(...) 我尝试使用 arg:
Currently the order in which setup.py pulls down dependencies (as listed in the arg install_requires) seems practically random. Also, in the setup.py setup(...) I tried using the arg:
extras_require={'scikits.timeseries': ['numpy']}
...没有成功,安装依赖的顺序不受影响.
...without success, the order of installing dependencies was unaffected.
我也尝试设置一个 pip 需求文件,但是 pip 安装依赖项的顺序与需求文件的行顺序不匹配,所以没有运气.
I also tried setting up a pip requirements file, but there too, pip's order of installing dependencies didn't match the line-order of the requirements file, so no luck.
另一种可能性是在 setup.py 顶部附近有一个系统调用,在 setup(...) 调用之前安装 numpy,但我希望有更好的方法.提前感谢您的帮助.
Another possibility would be to have a system call near the top of setup.py, to install numpy before the setup(...) call, but I hope there's a better way. Thanks in advance for any help.
推荐答案
如果 scikits.timeseries 需要 numpy,那么它应该将其声明为依赖项.如果是这样,那么 pip 会为您处理事情(我很确定 setuptools 也会,但我已经很久没有使用它了).如果你控制 scikits.timeseries,那么你应该修复它的依赖声明.
If scikits.timeseries needs numpy, then it should declare it as a dependency. If it did, then pip would handle things for you (I'm pretty sure setuptools would, too, but I haven't used it in a long while). If you control scikits.timeseries, then you should fix it's dependency declarations.
这篇关于在 setup.py 或 pip 需求文件中,如何控制安装包依赖项的顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)