說明:藍色=命令名稱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