python安裝及其tab補全

來源:互聯網
上載者:User

標籤:python.linux.安裝

聲明,普通linux系統都是內建python,若是2.7的版本,就用著吧,若不是建議先卸載再安裝.

1.下載安裝包

wget  https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz

2.解壓安裝

tar -zxvf Python-2.7.9.tgz

cd Python-2.7.9

yum –y install readline-devel  (上下左右功能)

./configure

make &&make install

3.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 sys

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

 ------------------------------------------------------------------

echo export PYTHONSTARTUP=/usr/local/lib/python2.7/tab.py>>/root/.bashrc

source /root/.bashrc

 至此OK.


本文出自 “君子不器” 部落格,請務必保留此出處http://cesar.blog.51cto.com/4356026/1631309

python安裝及其tab補全

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.