Created
August 14, 2017 05:29
-
-
Save wblondel/843d3e2d3c37a28d5a74001c9c434006 to your computer and use it in GitHub Desktop.
Check Python version at runtime
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def check_installation(rv): | |
current_version = sys.version_info | |
if current_version[0] == rv[0] and current_version[1] >= rv[1]: | |
pass | |
else: | |
sys.stderr.write("[%s] - Error: Your Python interpreter must be %d.%d or greater (within major version %d)\n" % (sys.argv[0], rv[0], rv[1], rv[0]) ) | |
sys.exit(-1) | |
return 0 | |
required_version = (3, 6) | |
check_installation(required_version) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment