说明:蓝色=命令名称python
浅绿=命令参数bash
浅蓝=选项ide
紫色=目录spa
系统环境:CentOS 5.8 x86_64blog
Python版本:2.7.3get
在用户宿主目录创建 .pythonstartup 文件内容以下:string
- # 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 文件中加入环境变量:it
echo "export PYTHONSTARTUP=~/.pythonstartup" >> ~/.bashrcio
退出从新登陆,效果如图:class