centos6.8 安装 Python2.7.x

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
相关文章
相关标签/搜索