Enforcing python version in setup.py

后端 未结 2 564
故里飘歌
故里飘歌 2020-12-09 14:25

Currently, we are setting\\installing up some packages on system by mentioning their version and dependencies in setup.py under install_requires at

2条回答
  •  再見小時候
    2020-12-09 15:06

    As the setup.py file is installed via pip (and pip itself is run by the python interpreter) it is not possible to specify which Python version to use in the setup.py file.

    Instead have a look at this answer to setup.py: restrict the allowable version of the python interpreter which has a basic workaround to stop the install.

    In your case the code would be:

    import sys
    if sys.version_info < (2,7):
        sys.exit('Sorry, Python < 2.7 is not supported')
    

提交回复
热议问题