In setup.py or pip requirements file, how to control order of installing package dependencies?(在 setup.py 或 pip 需求文件中,如何控制安装包依赖项的顺序?)
问题描述
我有一个 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 需求文件中,如何控制安装包依赖项的顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 setup.py 或 pip 需求文件中,如何控制安装包依赖项的顺序?
- 检查具有纬度和经度的地理点是否在 shapefile 中 2022-01-01
- YouTube API v3 返回截断的观看记录 2022-01-01
- 使用 Cython 将 Python 链接到共享库 2022-01-01
- 我如何卸载 PyTorch? 2022-01-01
- 计算测试数量的Python单元测试 2022-01-01
- 我如何透明地重定向一个Python导入? 2022-01-01
- CTR 中的 AES 如何用于 Python 和 PyCrypto? 2022-01-01
- 使用公司代理使Python3.x Slack(松弛客户端) 2022-01-01
- 如何使用PYSPARK从Spark获得批次行 2022-01-01
- ";find_element_by_name(';name';)";和&QOOT;FIND_ELEMENT(BY NAME,';NAME';)";之间有什么区别? 2022-01-01
