Linux comes with the download tool wget download as follows:
|
wget http://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz |
Download completed to download directory, unzip
|
tar -zxvf Python-2.7.9.tgz |
Go to the Unpacked folder
CD./python-2.7.9
Build a folder in/usr/local before compiling python27 (as a Python installation path to avoid overwriting the old version)
, &NB Sp , &NB Sp , &NB Sp mkdir
< Code class= "plain" >/usr/ local
/python27
Compile and install in the extracted directory / nbsp , &NB Sp , &NB Sp , &NB Sp
./configure --prefix=/usr/
local
/python27
Make
Make install
Can do this:./configure --prefix=/usr/
local
/python27 && make && make install
The old version is not overwritten at this time, then the original/usr/bin/python link is changed to another name
|
mv /usr/bin/python /usr/bin/python_old |
Link to build a new version of Python
|
ln -s /usr/ local /python27/bin/python2.7 /usr/bin/python |
This time input
The new version of Python will be displayed.
Modify the Yum/usr/bin/yum and make sure that the Yum source is available in many different levels Python causes Yum to fail to install software using Yum Error: Error so all done, re-test yum
Modifying the configuration allows Yum to work properly: change the name of the Python 2.6.6 we modified above
Next: Install setuptools pip to make Python installation module more convenient
To install PIP first Setuptools
1: First Download setuptools.py
wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.pysudo python ez_setup.py --insecure
2: Download: install pip.py
Download file wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate
Performing the installation of Python get-pip.py
If the PIP command is not available after installation
Workaround: Create a pip soft link
Ln-s/usr/Local/python27/bin/pip/usr/bin/pip
Finally: for example, install Pustil "pip install Pustil" cannot find the source or network download failure network difference can change python pip download source changed to domestic
Temporary use: Tsinghua Mirror source Https://pypi.tuna.tsinghua.edu.cn/simple
You can add the parameter-I https://pypi.tuna.tsinghua.edu.cn/simple when using PIP
For example: Pip install-i https://pypi.tuna.tsinghua.edu.cn/simple Pustil, this will be from the Tsinghua side of the mirror to install the Pustil library.
You can also specify the module version to be installed, such as Django
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple Django==1.11.3
pip uninstall pustil
Mark linux_6.8 python_2.6.6 Setup version upgrade Python 2.7.9 install PIP temporarily use the National Image source Library to specify the module version to delete the specified module