centos 6.6 安装python 2.7.14

前端之家收集整理的这篇文章主要介绍了centos 6.6 安装python 2.7.14前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
    1. centos 6.6 安装python 2.7.14
    1. 查看CentOS版本和系统默认Python版本:
    1. cat /etc/redhat-release

    1. python -V

    1. 安装依赖软件包及包组:
    1. yum -y groupinstall "Development tools"

    1. yum -y install zlib-devel bzip2-devel openssl-devel ncurses-develsqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-develxz-devel man

    1. 设置CentOS 6.9当前系统时间:
    1. date 071017452017.20 如果时间正确就不用修改

    1. 编译安装Python-2.7.14:
    1. cd /usr/src

    1. tar -xf Python-2.7.14.tar.xz

    1. cd Python-2.7.14

    1. ./configure --prefix=/usr/local/python2.7.14 --enable-shared--enable-profiling --disable-ipv6 --with-signal-module --with-dec-threads--with-threads --with-pth --with-doc-strings --with-tsc --with-pymalloc--with-wctype-functions --with-fpectl

    1. make

    1. make install

    1. 更改CentOS 6.6的默认Python版本为2.7.14:
    1. mv /usr/bin/python /usr/bin/python2.6.6-old

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

    1. 添加至PATH环境变量:
    1. vim /etc/profile.d/python2.7.14.sh

    1. export PATH=/usr/local/python2.7.14/bin:$PATH
    1. . /etc/profile.d/python2.7.14.sh

    1. echo $PATH

    1. 配置头文件:
    1. ln -s /usr/local/python2.7.14/include /usr/include/python2.7.14

    1. 配置库文件:
    1. echo "/usr/local/python2.7.14/lib" >/etc/ld.so.conf.d/python2.7.14.conf

    1. cat /etc/ld.so.conf.d/python2.7.14.conf

    1. ldconfig

    1. 配置man帮助文档:
    1. vim /etc/man.config,新增如下代码:

    1. MANPATH /usr/local/python2.7.14/share/man
    1. 查看配置后的Python版本:
    1. python -V

    1. python2 -V

    1. wget -q https://bootstrap.pypa.io/get-pip.py

    1. python get-pip.py

    1. mv /usr/bin/pip /usr/bin/pip2.6.6-old

    1. ln -s /usr/local/python2.7.14/bin/pip2.7 /usr/bin/pip

    1. 解决yum无法使用的问题:
    1. #cd /usr/bin/
    1. #vi yum
    1. 将第一行的 #!/usr/bin/python 改为 #!/usr/bin/python2.6.6-old 将yum指向旧的python2.6.6
        1. **

猜你在找的CentOS相关文章