Mac系统之Python命令行tab键补全
2016-06-20 22:17
495 查看
新建~/.pythonstartup文件并写入以下内容:
然后设置环境变量PYTHONSTARTUP,可以在家目录的~/.bash_profile文件中进行设置,追加如下一行。如下:
重新加载~/.bash_profile配置文件,
设置完毕,可以进入python的命令行终端,进行验证是否可以进行tab键补全,
好了,经过验证是可以进行补全的。
本文出自 “固态U盘” 博客,请务必保留此出处http://lavenliu.blog.51cto.com/5060944/1791183
$ cat ~/.pythonstartup import sys import readline import rlcompleter if sys.platform == 'darwin' and sys.version_info[0] == 2: readline.parse_and_bind("bind ^I rl_complete") else: readline.parse_and_bind("tab: complete")
然后设置环境变量PYTHONSTARTUP,可以在家目录的~/.bash_profile文件中进行设置,追加如下一行。如下:
export PYTHONSTARTUP=$HOME/.pythonstartup
重新加载~/.bash_profile配置文件,
. ~/.bash_profile
设置完毕,可以进入python的命令行终端,进行验证是否可以进行tab键补全,
python Python 2.7.10 (default, Oct 23 2015, 19:19:21) [GCC 4.1.7 Compatible Apple LLVM 6.8.0 (clang-500.0.11.5)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> print sys.p sys.path sys.platform sys.ps2 sys.path_hooks sys.prefix sys.py3kwarning sys.path_importer_cache sys.ps1 >>> print sys.p
好了,经过验证是可以进行补全的。
本文出自 “固态U盘” 博客,请务必保留此出处http://lavenliu.blog.51cto.com/5060944/1791183
相关文章推荐
- python利用utf-8编码判断中文英文字符
- python之字符串生成str(),repr()及' '
- python 反射笔记
- numpy函数:tile函数
- Installing packages into Canopy User Python from the OS command line
- mac上搭建python虚拟开发环境
- python dictionary
- python简单之isinstance,type使用
- python string
- python set
- python encode和decode函数说明
- python list
- numpy函数:shape用法
- python 之切片的另一个使用方式
- Python3标准库简介
- python-聊聊反射
- python ConfigParser、shutil、subprocess、ElementTree模块简解
- python(django)页面导出excel
- Python爬虫实践(五):Cookie
- Ubuntu caffe安装python/caffe/_caffe.cpp:1:52: fatal error: Python.h: No such file or directory