发布时间:2019-09-12 07:55:51编辑:auto阅读(3072)
说明:蓝色=命令名称
浅绿=命令参数
浅蓝=选项
紫色=目录
系统环境:CentOS 5.8 x86_64
Python版本:2.7.3
在用户宿主目录建立 .pythonstartup 文件内容如下:
- # python startup file
- 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
在宿主目录的 .bashrc 文件中加入环境变量:
echo "export PYTHONSTARTUP=~/.pythonstartup" >> ~/.bashrc
退出重新登录,效果如图:
上一篇: [Python]使用smtplib类库发
下一篇: Python list(列表) 详细总结
54944
41732
36322
31759
26657
26344
24873
20481
16421
15837
2962°
2695°
2796°
2936°
2872°
3133°
3025°
2873°
2864°
2837°