tab的模块脚本
[root@centos7 ~]# cat tab.py #!/usr/bin/python3.6 # python startup file 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
如果报错说找不到readline模块,请安装gnureadline,python3.6版本使用readline会报错,可以查看我的另外一篇博客 linux中使用pip命令遇到的一些问题
注意:tab.py模块要放在你能搜索的路径下面