Skip to content

Instantly share code, notes, and snippets.

@happysundar
Created February 27, 2014 20:45
Show Gist options
  • Save happysundar/9259182 to your computer and use it in GitHub Desktop.
Save happysundar/9259182 to your computer and use it in GitHub Desktop.
check python version, virtual env presence
def check_env():
(py_major, py_minor, py_patchlevel) = platform.python_version_tuple()
if py_major != '2' and py_minor != '7':
exit("This script should be run in python version 2.7.X. Current version of python is %s" % platform.python_version())
if not hasattr(sys, 'real_prefix'):
exit("This script should be run within a virtualevn. Have you run the 'workon <virtual_env_name>' command?")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment