setup.py: restrict the allowable version of the python interpreter

孤者浪人 提交于 2019-11-27 01:41:57

As of version 9.0.1 pip will honor a new python_requires string, specifying the python version required for installation, eg:

setup(
    ...,
    python_requires=">=3.3"
)

See here for more details. See also this answer on SO.

a possible solution is to test for the python version, since pip can't satisfy the python version except for the version it's currently running in (it installs in the current python environment):

import sys
if not sys.version_info[0] == 2:
    sys.exit("Sorry, Python 3 is not supported (yet)")

setup(...
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!