How to detect minimum version of python that a script required

I have built an application with python. How can I detect minimum version of Python that my application needs?

Like Django , in that website it tells you the minimum version of python that it required (example: 2.6.6 and later).

It means I wanna tell to user what minimum version of python he should install on his system


There isn't really an automated way to check what features your code is using and correlate that to specific Python versions. If your code relies on fixed bugs or additional keywords to existing methods, the version detection gets harder still.

Generally speaking, you set the minimal version based on experience and knowledge of what features you are using; you can check the What's New documentation.

If you have a comprehensive test suite, you could just run that on older Python versions; if all your tests pass you support that older version.


I know this is an old post, but I've recently started a project called Vermin that tries to detect the minimum required Python versions needed to run code. It will do what you request, @Mortezaipo.

链接地址: http://www.djcxy.com/p/78570.html

上一篇: 检查MySQL表是否为空:COUNT(*)为零与LIMIT(0,1)有结果?

下一篇: 如何检测脚本所需的最低版本的python