Python2.7.12 Development Environment Construction (auto-complete)

Source: Internet
Author: User

First, install the Readline-devel package

Python's compiled installation relies on this package

Yum-y Install Readline-devel

Second, installation Python2.7.12

Python official website (download here):https://www.python.org/

# Tar XF python-2.7.12.tgz

# CD Python-2.7.12

#./configure--prefix=/usr/local/python27

# Make && make install

# ln-sv/usr/local/python27/bin/python2.7/usr/bin/python27

third, add Python auto complement function for VIM editor

1 , download Python auto-complete plugin: pydiction

wget https://github.com/rkulla/pydiction/archive/master.zip

# Unzip-q Master

# MV Pydiction-master Pydiction

# mkdir-p ~/.vim/tools/pydiction

# cp-r Pydiction/after ~/.vim

# CP Pydiction/complete-dict ~/.vim/tools/pydiction

2, ~/.VIM directory structure is as follows:

# Tree ~/.vim

/root/.vim

├──after

│└──ftplugin

│└──python_pydiction.vim

└──tools

└──pydiction

└──complete-dict

3, edit ~/.VIMRC, add the following content

FileType plugin on

Let g:pydiction_location = ' ~/.vim/tools/pydiction/complete-dict '

4, use Vim to edit a py file, test whether successful

The scenario description is configured successfully

Iv. Configuring automatic completion for Python in interactive mode

1./usr/local/python27/lib/python2.7/site-packages add tab.py file in Python installation directory

The tab file contents are as follows:

#!/usr/bin/env python27#python startup fileImportSYSImportReadLineImportRlcompleterImportatexitImportOS#Tab CompletionReadline.parse_and_bind ('Tab:complete')#History FileHistfile = Os.path.join (os.environ['HOME'],'. Pythonhistory')Try: Readline.read_history_file (histfile)exceptIOError:PassAtexit.register (Readline.write_history_file, Histfile)delOS, Histfile, ReadLine, Rlcompleter

2. Add Environment variables:

#vim ~/.BASHRC Add the following:

#for python tab

Export pythonstartup=/usr/local/python27/lib/python2.7/site-packages/tab.py

3. Re-login to the shell for testing:

and shell usage, press TAB to complete, press the TAB key to list all the commands that begin with the input character.

Python2.7.12 Development Environment Construction (auto-complete)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.