re2d2 发表于 2015-4-13 08:52:52

python安装及其tab补全

声明,普通linux系统都是自带python,若是2.7的版本,就用着吧,若不是建议先卸载再安装.
1.下载安装包
wgethttps://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz2.解压安装tar -zxvf Python-2.7.9.tgzcd Python-2.7.9yum –y install readline-devel(上下左右功能)./configuremake &&make install3.Tab补全功能3.1查看python路径python>>>import sys>>>sys.path['', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages']>>>cd/usr/local/lib/python2.7-------------------py附件无法上传,直接把内容复制进去vim tab.py#!/usr/bin/python# python startup 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 ------------------------------------------------------------------echo export PYTHONSTARTUP=/usr/local/lib/python2.7/tab.py>>/root/.bashrcsource /root/.bashrc 至此OK.
页: [1]
查看完整版本: python安装及其tab补全