Python3 Linux安装

环境

系统版本:CentOS Linux release 8.3.2011

Python版本:Python-3.11.0a1

Python下载地址:https://www.python.org/ftp/python/

  1. 下载安装包

    [root@i-h0xe1oiq data]# wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0a1.tgz
    [root@i-h0xe1oiq data]# ll -h
    total 24M
    -rw-r--r-- 1 root root 24M Oct  5 20:45 Python-3.11.0a1.tgz
    
  2. 安装依赖包

    [root@i-h0xe1oiq data]# yum -y install gcc gcc-c++ make openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel zlib-devel libffi-devel
    
  3. 解压安装包

    [root@i-h0xe1oiq data]# tar xf Python-3.11.0a1.tgz 
    
  4. 进入解压目录

    [root@i-h0xe1oiq data]# cd Python-3.11.0a1
    
  5. 编译安装

    [root@i-h0xe1oiq Python-3.11.0a1]# ./configure
    [root@i-h0xe1oiq Python-3.11.0a1]# make
    [root@i-h0xe1oiq Python-3.11.0a1]# make install
    
    # 当出现"Successfully installed pip-21.2.3 setuptools-57.4.0"时表示安装成功
    
  6. 验证

    [root@i-h0xe1oiq Python-3.11.0a1]# which  python3.11
    /usr/local/bin/python3.11
    [root@i-h0xe1oiq Python-3.11.0a1]# python3.11 -V
    Python 3.11.0a1
    [root@i-h0xe1oiq Python-3.11.0a1]# pip3.11 -V
    pip 21.2.3 from /usr/local/lib/python3.11/site-packages/pip (python 3.11)
    
posted @ 2021-10-21 14:12  忘川的彼岸  阅读(300)  评论(0编辑  收藏  举报