python2.6 version 2.7 upgrade

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/weixin_37038498/article/details/74181310

A. Download the 2.7 version python and related components

  1. Downloaded from the official website https://www.python.org/
  2. Download pip
  3. Download setuptools

II. Installation

  • Uploading and downloading the above packages to the server
  • Install python
tar xf Python-2.7.13.tgz
cd Python-2.7.13
./configure --prefix=/usr/local/python27
make -j 4
make install
  • Adding Environment Variables
vim /etc/profile
#在末尾添加
export PATH=/usr/local/python27/bin/:$PATH

Reload the configuration file

source /etc/profile

At this python version has been modified to 2.7.13

[root@test ~]# python --version
Python 2.7.13

If you are using the older version, you can use python2.6

[root@test ~]# python2.6 --version
Python 2.6.6
  • Install setuptools
unzip setuptools-36.0.1.zip
cd setuptools-36.0.1
python setup.py install
  • Installation pip
tar zxf pip-9.0.1.tar.gz
cd pip-9.0.1
python setup.py install

pip version

[root@test ~]# pip --version
pip 9.0.1 from /usr/local/python27/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)
  • Problems installing version using python yum

At this point yum still using an older version of python

Guess you like

Origin blog.csdn.net/weixin_37038498/article/details/74181310