centOS上python3安装

作者: 蒋昉霖 | 来源:发表于2017-08-30 13:37 被阅读98次

    安装依赖
    yum install xz wget gcc make gdbm-devel openssl-devel sqlite-devel zlib-devel bzip2-devel -y

    下载源码:wget -c https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz

    备份Python2的环境
    mv /usr/bin/python /usr/bin/python_bak

    编译安装3:
    tar zxvf Python-3.6.2.tgz
    cd Python-3.6.2
    ./configure --prefix=/usr/local/python3 --enable-shared --enable-loadable-sqlite-extensions --with-zlib
    make
    make install

    添加软连接
    ln -s /usr/local/python3/bin/python3.6 /usr/bin/python

    添加链接库
    vi /etc/ld.so.conf
    添加/usr/local/python3/lib/

    让链接库生效
    /sbin/ldconfig

    更改以下文件头 #!/usr/bin/python 改为 #!/usr/bin/python_bak

    /usr/bin/yum
    /usr/libexec/urlgrabber-ext-down
    /usr/bin/yum-config-manager
    /usr/bin/yum-debug-restore
    /usr/bin/yum-groups-manager
    /usr/bin/yum-builddep
    /usr/bin/yum-debug-dump
    /usr/bin/yumdownloader
    /usr/bin/gnome-tweak-tool

    相关文章

      网友评论

        本文标题:centOS上python3安装

        本文链接:https://www.haomeiwen.com/subject/asltjxtx.html