美文网首页
CentOS离线安装Python

CentOS离线安装Python

作者: tiantianlyc | 来源:发表于2019-12-02 16:01 被阅读0次

    1.下载python安装包以及依赖的包

    python安装包:Python-3.7.0

    下载地址:www.python.org/ftp/python/3.7.5/Python-3.7.5.tar.xz

    依赖安装包

    zlib-devel     krb5-devel     ibselinux-devel

    bzip2-devel    openssl-devel    ncurses-devel

    sqlite-devel     readline-devel    tk-devel

    gdbm-devel    db4-devel      libpcap-devel     xz-devel

    下载地址:http://rpmfind.net/linux/rpm2html/search.php?query=xz-devel&submit=Search+...&system=&arch=

    2.上传这些安装包到任意目录下

    将这些包上传至CentOS服务器,然后运行rpm -ivh **.rpm,进行解压安装(在此略过)。

    3.解压python安装包

    tar -xvJf  Python-3.7.0.tar.xz</pre>
    

    4.编译安装

    mkdir /usr/local/python3 # 创建编译安装目录
    cd Python-3.7.0      # 进入python的解压目录
    ./configure --prefix=/usr/local/python3 # 指定安装位置
    make && make install   # 编译及安装
    

    5.创建软连接

    ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
    ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3
    

    6.验证是否安装成功

    python3 -V
    pip3 -V
    

    相关文章

      网友评论

          本文标题:CentOS离线安装Python

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