PYTHON SHELL AUTOCOMPLETE CONFIG

812 ワード

create python start up script .pythonrc
import rlcompleter, readline, os atexit
readline.parse_and_bind('tab: complete')
history_file = os.path.expanduser('~/.python_history')
readline.read_history_file(history_file)
atexit.register(readline.write_history_file, history_file)

Note: install the readline package if it is not ready.
Set environment variable PYTHONSTARTUP
export PYTHONSTARTUP=~/.pythonrc

Reload the environment
source ~/.zshrc (~/.bashrc for bash),or you can open a new shell