= 1.2.7 if py-6ren">
gpt4 book ai didi

python - install_requires 基于 python 版本

转载 作者:IT老高 更新时间:2023-10-28 21:46:53 27 4
gpt4 key购买 nike

我有一个适用于 python 2 和 python 3 的模块。在 Python<3.2 中,我想安装一个特定的包作为依赖项。对于 Python>=3.2。

类似:

 install_requires=[
"threadpool >= 1.2.7 if python_version < 3.2.0",
],

如何做到这一点?

最佳答案

使用 environment markers :

install_requires=[
'threadpool >= 1.2.7; python_version < "3.2.0"',
]

Setuptools 的具体用法在其documentation 中有详细说明。 .上面显示的语法需要 setuptools v36.2+ (change log) .

关于python - install_requires 基于 python 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21082091/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com