centos7 安装python 3

Posted 黑暗森林

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7 安装python 3相关的知识,希望对你有一定的参考价值。

  • 下载
wget -c https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz  
  • 解压到/usr/local/
  • 依赖包安装
yum install libffi-devel
yum install openssl-devel

// 可能还有一些依赖的,我的环境之前已经安装过
// yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel

  • 编译
cd Python-3.9.6/
mkdir /usr/local/python3
./configure -prefix=/usr/local/python3
make
make install
  • 链接python3. pip3

    ln -s /usr/local/python3/bin/python3.9 /usr/bin/python3
    ln -s /usr/local/python3/bin/pip3.9 /usr/bin/pip3
  • 测试

    $ python3 --version
    Python 3.9.6
    $ pip3 --version
    pip 21.1.3 from /usr/local/python3/lib/python3.9/site-packages/pip (python 3.9)

以上是关于centos7 安装python 3的主要内容,如果未能解决你的问题,请参考以下文章

CentOS7.3编译安装python3.6

CentOS7安装Python3

Centos7手动编译安装Python3

Centos7安装python3.5

centos7 安装python3

centos7安装python3