简体   繁体   中英

Using python_requires to require Python 2.7 or 3.2+

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

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

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

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

The commas , are equivalent to logical and operator.

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

This answer may be a bit too specific for you, but if you are using the AI Platform in Google Cloud Platform (GCP) to train your model, then you may simply specify the Python version at the command line by setting the flag --python-version 3.5O Otherwise the default is 2.7, even if using a runtime-version that carries capability of different versions. I do not know, however, if this flag will support multiple versions, like you have asked. Source

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM