Centos default python2.6 upgrade to

Centos installs the default python2.6 upgrade to python2.7, and solves various problems of python toolkit installation.

Idea guide: Upgrade 2.7 can not use yum to install python toolkit. Suggest using pip

  1. Update instructions

yum -y update

yum groupinstall -y 'development tools'

  1. In addition, you need to install additional packages SSL, bz2, zlib required by the python tool

yum install -y zlib-devel bzip2-devel openssl-devel xz-libs wget gcc

  1. Install Python 2.7.x from source

wget http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz

tar -xvf Python-2.7.8.tar.xz

Enter the catalog:

cd Python-2.7.8

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

Compile and install:

make

make install

Check the Python version:

[ root@dbmasterxxx ~]# python2.7 -V

Python 2.7.8

  1. Backup python2.6, set python2.7

mv  /usr/bin/python  /usr/bin/python2.6

ln -s /usr/local/bin/python2.7  /usr/bin/python

[ root@dbmasterxxx ~]# python -V

Python 2.7.8

  1. pip installation (pip is a tool for installing and managing Python packages, used to replace easy_install)

You cannot use yum to install the python module after upgrading to 2.7, because yum will install the module into python2.6 by default.

So use pip to install the python module. Therefore, pip needs to be installed in the new 2.7.

5.1 pip installation steps (pip uses source code installation, because yum installation will be installed to 2.6)

wget --no-check-certificate https://github.com/pypa/pip/archive/1.5.5.tar.gz

tar zvxf 1.5.5.tar.gz #Unzip the file

cd pip-1.5.5/

python setup.py install

5.2 Delete the original pip and create a 2.7 pip

rm -rf /usr/bin/pip

ln /usr/local/bin/pip /usr/bin/pip

5.3 If you cannot install pip, install the setuptools package first

wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz

tar zxvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
python setup.py build
python setup.py install

  1. To install the python toolkit, you must use pip (recommended) or easy_install, because the python installed by yum will be installed in the 2.6 pit. example:

pip install DjangoCaptcha

Recommended Posts

Centos default python2.6 upgrade to
Centos 6.4 python 2.6 upgrade to 2.7
Centos 6.4 python 2.6 upgrade to 2.7
CentOS upgrade python2 to pyth
CentOS7 upgrade python3
Centos6.7 comes with python upgrade to
CentOS6.5 upgrade kernel to 3.10.28
CentOS + Python3.6+
Centos 7.5 python3.6
How to upgrade CentOS7 to CentOS8 (detailed steps)
How to install Python 3.8 on CentOS 8
How to install Python on CentOS 8
CentOS7 repairs python to save yum
Centos6 install Python2.7.13
Ubuntu16 upgrade Python3
Centos7 install Python 3.6.
CentOS install Python 3.6
Python - centos6 installation
Centos7 install Python2.7
01. Introduction to Python
Centos6.5 openssh upgrade
Centos python3 compile installation and compile gcc upgrade
R&D: How To Install Python 3 on CentOS 7
Centos install Python3
Centos7 upgrade kernel
CentOS6.8 install python2.7
centos6.9 rabbitmq 3.6.8 upgrade 3.8.2
Introduction to Python
ubuntu16.04 upgrade python2
How to upgrade all Python libraries on Ubuntu 18.04
CentOS7.5-1804 system kernel upgrade
How to upgrade to Ubuntu 20.04
Centos source installation Python3
Centos kernel version upgrade
CentOS 5 to CentOS 5.8 YUM source
CentOS Python Java installations
How to upgrade to Ubuntu 20.04
The specific steps to upgrade python on Raspberry Pi
Solution to python alignment error
Python code to find bugs (2)
Python code to find bugs(7)
How to comment python code
centos7 install python3 and ipython
Python code to find bugs(4)
Python code to find bugs (3)
Python code to find bugs(9)
Centos7.6 method to install Tomcat-8.5.39
Upgrade Ubuntu 18.04 on Azure to 18.10
How to learn python quickly
How to uninstall python plugin
Centos 6.10 reinstall python and yum
Introduction to Python related modules
ububtu10.04, 11.10 online upgrade to ubuntu12.04LTS
CentOS7 install python3 and pip3
Python code to find bugs(6)
CentOS 6.9 compile and install python
Python code to find bugs (1)
Python code to find bugs(8)
3 ways to encrypt Python files
Centos6 install python3 pip3 ipython3
How to understand python objects