Created
March 8, 2014 22:14
-
-
Save prophile/9439745 to your computer and use it in GitHub Desktop.
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 subprocess | |
| import sys | |
| try: | |
| policy = subprocess.check_output(['apt-cache', 'policy', 'python-dev']) | |
| if 'Installed: (none)' in policy: | |
| print("ERROR: no python dev package installed") | |
| print("Please run: sudo apt-get install python-dev") | |
| sys.exit(1) | |
| except OSError: | |
| try: | |
| subprocess.check_output(['rpm', '-qi', 'python-devel']) | |
| except subprocess.CalledProcessError: | |
| print("ERROR: no python dev package installed") | |
| print("Please run: sudo yum install python-devel") | |
| except OSError: | |
| print("NOTICE: OS detection failed, assuming Python dev packages") | |
| print("If you see an error about Python.h, install your OS's python dev package") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment