标签:
1、添加python自动补全的脚本
vim ~/.pythonstartup #添加如下 #!/usr/bin/python import sys import readline import rlcompleter import atexit import os # tab completion readline.parse_and_bind(‘tab: complete‘) # history file histfile = os.path.join(os.environ[‘HOME‘], ‘.pythonhistory‘) try: readline.read_history_file(histfile) except IOError: pass atexit.register(readline.write_history_file, histfile) del os, histfile, readline, rlcompleter
2、添加到~/.bashrc
echo ‘export PYTHONSTARTUP="/root/.pythonstartup"‘ >> ~/.bashrc source ~/.bashrc
3、测试
[root@python ~]# python Python 2.7.11 (default, Mar 29 2016, 23:35:44) [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> os.t #tab可以补全 os.tcgetpgrp( os.tcsetpgrp( os.tempnam( os.times( os.tmpfile( os.tmpnam( os.ttyname(
标签:
原文地址:http://www.cnblogs.com/huangweimin/p/5628074.html