发布时间:2019-06-24 15:40:14编辑:auto阅读(2170)
1. 先准备一个tab.py的脚本
shell> cat tab.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #!/usr/bin/python# python tab file import 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. 查看Python默认的模块存放地址
1 2 3 4 5 6 7 | [root@localhost ~]# pythonPython 2.6.6 (r266:84292, Nov 22 2013, 12:16:22)[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import sys>>> sys.path['', '/usr/lib64/python26.zip', '/usr/lib64/python2.6', '/usr/lib64/python2.6/plat-linux2', |
3. 拷贝该脚本到默认模块存放路径
1 | cp tab.py /usr/lib64/python2.6/ |
4. 现在可以用了
上一篇: python第4天
下一篇: Python之守护线程与锁
51178
50587
41211
38036
32500
29403
28265
23119
23083
21411
1463°
2181°
1805°
1732°
2041°
1798°
2479°
4167°
4032°
2880°