转:配置python命令tab键自动补全
1.edit and configure pythonstartup file
# python startup fileimport sysimport readlineimport rlcompleterimport atexitimport os# tab completionreadline.parse_and_bind('tab: complete')# history filehistfile = os.path.join(os.environ['HOME'], '.pythonhistory')try: readline.read_history_file(histfile)except IOError: passatexit.register(readline.write_history_file, histfile)del os, histfile, readline, rlcompleter
2. add the enviroment varable to system with administrator role
For windowns
pythonstartupf=path/pythonstartup.py
For Linux
add the following to you ~/.bash_profile或bashrc
export PYTHONSTARTUP=~/.pythonstartup