Before starting the Python basics, install the environment first. The following process is done under the Linux operating system, root user, mainly installs the 2.7 version of Python, and the Pip, Ipython, virtualenv and other tools, and finally Vim's settings.
1. Install Python.
# wget Https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tgz
Python-2.7.14 #./configure--prefix=/usr/local/python27
Python-2.7.14 # Make
Python-2.7.14 # Make Install
Add the/usr/local/python27/bin to the environment variable path.
# grep ' PATH ' ~/.bash_profile
Path=/usr/local/python27/bin:/usr/local/mysql/bin: $PATH: $HOME/bin
Export PATH
# source ~/.bash_profile
# python--version
Python 2.7.14
2. Install the Setuptools, which is the PIP dependency.
# wget https://pypi.python.org/packages/e9/c3/5986db56819bd88e1a250cad2a97249211686b1b7b5d95f9ab64d403a2cb/ Setuptools-38.2.5.zip#md5=abfd02fba07b381c3a9682a32d765cc6
setuptools-38.2.5 # python setup.py install
3. Install PIP, which is the management tool for Python packages.
# wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/ Pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9
pip-9.0.1 # python setup.py install
4. Install Ipython, which is an enhanced interactive Python shell, useful in basic learning, scripting, and later to see its power.
# pip Install Ipython
5. Install Flake8, which is used for grammar checking, and Code specification (PEP8) checking, which is used here when Vim is set.
# pip Install Flake8
6. Install virtualenv, which is a python-developed virtual environment that will be used when developing flask applications.
# pip Install virtualenv
Initializes the virtual environment.
# Virtualenv/tmp/venus
New Python executable In/tmp/venus/bin/python
Installing Setuptools, Pip, Wheel...done.
into the virtual environment.
/tmp/venus # source Bin/activate
(Venus)/tmp/venus #
In a virtual environment, install flask.
(Venus)/tmp/venus # pip Install flask
Exit the virtual environment.
(Venus)/tmp/venus # Deactivate
#
7. Set VIM.
7.1 Downloads Vundle, which is the management tool for VIM plug-in, is also the only one to manually download directly when setting up vim, which acts like Pip.
# git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/vundle.vim
7.2 Download the. VIMRC configuration file, which is my address on GitHub and downloads it to the root user's home directory.
# wget HTTPS://RAW.GITHUBUSERCONTENT.COM/LSJJY/VIM-FOR-PYTHON/MASTER/.VIMRC
7.3 Execute the following command, Vundle automatically installs the plugin in the. vimrc file.
# vim +plugininstall +qall
The main plugins used in Vim, and their functions are outlined below.
Snipmate-code fragment completion.
Syntastic-code syntax, canonical (Static) check.
Jedi-vim-Programming hints.
Molokai, Vim-airline-Theme and sidebar landscaping.
If interested, you can follow the subscription number "database Best practices" (Dbbestpractice).
Python Basics Grooming-part No. 01