- If you are running python that was not compiled with readline (e.g. Mac OS X system Python), you may first have to run the following:
sudo easy_install -f http://ipython.scipy.org/dist/ readline
- Create a file in your home directory named .pythonrc.py
- Add the following lines to it:
import readline, rlcompleter
readline.parse_and_bind('tab: complete')
- Set your PYTHONSTARTUP environment variable to point to this file on shell startup, e.g.:
$ echo 'PYTHONSTARTUP="$HOME/.pythonrc.py"' >> .bashrc
- Prosper.
if you’re used to hitting tab for indenting in your interactive python, either switch to using a single space, or change complete to some other keybinding, e.g. readline.parse_and_bind(’\C-J: complete’)
Comment by magicbronson on August 19, 2008 at 3:26 pm