Skip to content

Instantly share code, notes, and snippets.

@johnrc
Last active August 29, 2015 14:05
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 johnrc/3550659001089e7a42fc to your computer and use it in GitHub Desktop.
Save johnrc/3550659001089e7a42fc to your computer and use it in GitHub Desktop.
Python command line cheatsheet

Install with setuptools with one or two steps: python setup.py build and python setup.py install. To uninstall follow the SO question here, which suggests

python setup.py install --record files.txt
cat files.txt | xargs rm -rf

RedHat has a thing called software collections that lets other versions of Python (and other languages or databases) be installed.

yum install python27
scl enable python27 bash
which python

To run a python script or program with the scl version of python, there are two ways.

The first picks up the environment variable for python

#!/usr/bin/env python

The second is to fully qualify the path for python

#!/opt/rh/python27/root/usr/bin/python
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment