Created
February 14, 2017 14:44
-
-
Save regardfs/23cd7660d2c6fd1cf46fd07f2e7356af to your computer and use it in GitHub Desktop.
python-autocomplete-setting.sh
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
# if you are in python3.X env, you should run | |
sudo apt-get install python3-dev | |
sudo apt-get install libevent-dev | |
sudo apt-get install 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