使用 python_requires 需要 Python 2.7 或 3.2+ [英] Using python_requires to require Python 2.7 or 3.2+

查看:41
本文介绍了使用 python_requires 需要 Python 2.7 或 3.2+的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 setup.py 中使用 python_requires 分类器来要求 Python 2.7.* 或 3.2+?

How do I use python_requires classifier in setup.py to require Python 2.7.* or 3.2+?

我尝试了很多配置,包括这个:~=2.7,==3,!=3.0,!=3.1,<4 但没有一个成功

I have tried many configurations, including this one: ~=2.7,==3,!=3.0,!=3.1,<4 but none have worked

推荐答案

setuptools 的这个参数使用 PEP440 版本说明符 规范,因此您可以要求:

This argument for setuptools uses the PEP440 version specifiers spec, so you can ask for:

python_requires='>=2.7,!=3.0.*,!=3.1.*'

逗号 , 等价于逻辑 and 运算符.

The commas , are equivalent to logical and operator.

注意生成的元数据是仅被尊重pip>=9.0.0(2016 年 11 月).

Note that the metadata generated is only respected by pip>=9.0.0 (Nov 2016).

这篇关于使用 python_requires 需要 Python 2.7 或 3.2+的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆