Freedom is not doing what you want to do, but not doing what you want to do. ——— Excerpt from 2016/11/30 night
Python was previously studied for some time, but all deployments are on Windows. is catching up with the recent learning Liux, after the continued study of Python based on Linux, casually write and record their own learning drip. Nonsense not much to say, on the big strokes:
Chairman Mao said that Python development without a development environment was bullying.
"Python Installation"
1.GCC Natural, the diagram is convenient, directly with "Development Tools":
Yum Groupinstall "Development tools"
Of course, some dependent packages are still needed:
Yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel
2. Installation of Python2.7, after all, many projects are python2.x:
wget Https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgztar vxf python-2.7.11.tgzcd python-2.7.11./ Configure--prefix=/usr/localmake && make install
3. Install PIP:
Download Setuptools First, address is https://pypi.python.org/packages/ff/d4/ 209f4939c49e31f5524fa0027bf1c8ec3107abaf7c61fdaad704a648c281/setuptools-21.0.0.tar.gz#md5= 81964fdb89534118707742e6d1a1ddb4
Tar vxf setuptools-21.0.0.tar.gz cd setuptools-21.0.0python setup.py Install
After installing Setuptools, install PIP:
is: https://pypi.python.org/packages/41/27/9a8d24e1b55bd8c85e4d022da2922cb206f183e2d18fee4e320c9547e751/ Pip-8.1.1.tar.gz#md5=6b86f11841e89c8241d689956ba99ed7
Tar vxf pip-8.1.1.tar.gz cd pip-8.1.1python setup.py install
After the installation is complete, run PIP and install the detection program:
Pip
Pip Install Psutil
4. Loading python file validation
"Configure Vim as a Python IDE development environment"
1. View the VIM editor version
Vim--version
In this step, you have to make sure that you have met the following two requirements:
(1) Vim edit version should be greater than 7.3.
(2) Support Python language. In the features of the selected editor, make sure you see the+python
2. Configure VIM alias so that vim becomes the default VI editor:
# echo alias vi=\ ' vim\ ' >> ~/.BASHRC
# source ~/.BASHRC
3. Copy the default. VIMRC initialization file:
# Cp/usr/share/vim/vim70/vimrc_example.vim ~/.vimrc# vi ~/.vimrc set tabstop=4 set softtabstop=4 set shiftwidth=4 set Expandtab set autoindent set number
4. Download the enhanced Python syntax highlighting script version:
#wget http://www.vim.org/scripts/script.php?script_id=790# mv/usr/share/vim/vim70/syntax/python.vim/usr/share/ vim/vim70/syntax/python.vim.ori# CP python.vim/usr/share/vim/vim70/syntax/
5. Generate Ctag sequence for script/project
Go to the directory where the script is located and execute:
# Ctag-r *
6.Python function, class auto-completion
# echo ' autocmd FileType python set omnifunc=pythoncomplete#complete ' >> ~/.vimrc# wget http://www.vim.org/scripts /script.php?script_id=850# Unzip pydiction-1.2.zip# CP python_pydiction.vim/usr/share/vim/vim70/ftplugin# MKDIR/USR /share/vim/vim70/pydiction# cp complete-dict pydiction.py/usr/share/vim/vim70/pydiction/# VI ~/.VIMRC #增加如下两行: let G: pydiction_location = '/usr/share/vim/vim70/pydiction/complete-dict ' Let G:pydiction_menu_height = 20
When writing a Python program, press the TAB key to activate the auto-complete menu.
7.Python Code Auto-Folding
#wget http://www.vim.org/scripts/script.php?script_id=515# CP python_fold.vim/usr/share/vim/vim70/plugin/# VI ~/. VIMRC #添加: Set foldmethod=indent
The specific commands are:
Zo: Open the folding code of the cursor position; Zc: The code to collapse the cursor position; the ZR: Opens all the collapsed code in the file; ZM: Collapses all open code in the file; ZR: Acts like a ZR, but opens sub-folds (folds in folds); ZM: The effect is similar to ZM, but it closes the sub fold; Zi : Toggle command between folding and opening operation;
At this point, a vim version of the Python IDE environment has been set up, not to try to get started.
centos6.5 Python IDE Development environment build