Python教程

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安装python3环境的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!