系统相关
首页 > 系统相关> > Centos安装python3环境

Centos安装python3环境

作者:互联网

  1. 先安装所需要的依赖

    sudo yum -y groupinstall "Development tools"
    sudo yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
    sudo yum install -y libffi-devel zlib1g-dev
    sudo yum install zlib* -y
    sudo yum gcc
    
  2. 下载python的安装包

    wget https://www.python.org/ftp/python/3.9.8/Python-3.9.8.tar.xz
    

    不想下3.9.8的版本的话可以去python下载地址这里面找对应版本的安装包

  3. 解压

    tar -xvJf  Python-3.9.8.tar.xz
    
  4. 安装

    cd Python-3.9.8
    sudo ./configure --prefix=/usr/local/python3
    sudo make
    sudo make install
    ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
    ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3
    
  5. 测试是否安装成功

    python3 -V
    pip3 -V
    

标签:Centos,local,sudo,devel,usr,安装,python3,3.9
来源: https://www.cnblogs.com/yunyunyu/p/15626348.html