Last active
February 17, 2017 08:53
-
-
Save regardfs/efdaac4ab548b78422ac4e9c0dc0975f to your computer and use it in GitHub Desktop.
python-autocomplete-setting.sh
This file contains 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
#!/usr/bin/env bash | |
# if you are in python3.X env, you should run | |
sudo apt-get -y install python3-dev libevent-dev libncurses5-dev | |
# if you are in python2.x env, then sudo apt-get install python-dev | |
# install readline | |
pip install readline | |
# config $HOME/.bashrc | |
echo "export PYTHONSTARTUP='$HOME/.pythonstartup'" >> $HOME/.bashrc | |
# config .pythonstartup | |
cat > $HOME/.pythonstartup << EOF | |
import os | |
import readline | |
import rlcompleter | |
import atexit | |
#tab completion | |
readline.parse_and_bind("tab: complete") | |
#history file | |
history_file = os.path.join(os.environ["HOME"],".pythonhistory") | |
try: | |
readline.read_history_file(history_file) | |
except IOError: | |
pass | |
atexit.register(readline.write_history_file,history_file) | |
del os,history_file,readline,rlcompleter | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment