读书人

转:配备python命令tab键自动补全

发布时间: 2012-09-25 09:55:58 作者: rapoo

转:配置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

读书人网 >perl python

热点推荐