Skip to content

Instantly share code, notes, and snippets.

@wblondel
Created August 14, 2017 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wblondel/843d3e2d3c37a28d5a74001c9c434006 to your computer and use it in GitHub Desktop.
Save wblondel/843d3e2d3c37a28d5a74001c9c434006 to your computer and use it in GitHub Desktop.
Check Python version at runtime
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