centos6.8
自带的python2.6.x,但是不能用pip,安装到 Python2.7 版本
wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tar.xz
xz -d Python-2.7.15.tar.xz
tar -xvf Python-2.7.15.tar.xz
cd Python-2.7.15.tar
./configure
make
make install
cd ~
python -V
安装完毕!
[root@bandwagon ~]# python -V
Python 2.7.15
[root@bandwagon ~]# ll /usr/local/bin/py*
-rwxr-xr-x 1 root root 84 Jul 3 03:25 /usr/local/bin/pydoc
lrwxrwxrwx 1 root root 7 Jul 3 03:26 /usr/local/bin/python -> python2
lrwxrwxrwx 1 root root 9 Jul 3 03:26 /usr/local/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 4723927 Jul 3 03:26 /usr/local/bin/python2.7
-rwxr-xr-x 1 root root 1687 Jul 3 03:26 /usr/local/bin/python2.7-config
lrwxrwxrwx 1 root root 16 Jul 3 03:26 /usr/local/bin/python2-config -> python2.7-config
lrwxrwxrwx 1 root root 14 Jul 3 03:26 /usr/local/bin/python-config -> python2-config
[root@bandwagon ~]#
安装 pip
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -i epel-release-latest-6.noarch.rpm
yum install python-setuptools # 这一步可以省略
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
本文介绍如何在 CentOS 6.8 上安装 Python 2.7 并配置 pip 工具。通过下载 Python 2.7 的源码包并进行编译安装,实现对旧版本 Python 的升级。最后通过额外的步骤安装 pip,方便后续的 Python 包管理。
4875

被折叠的 条评论
为什么被折叠?



