Python3 Linux安装
环境
系统版本:CentOS Linux release 8.3.2011
Python版本:Python-3.11.0a1
Python下载地址:https://www.python.org/ftp/python/
-
下载安装包
[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
-
安装依赖包
[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
-
解压安装包
[root@i-h0xe1oiq data]# tar xf Python-3.11.0a1.tgz
-
进入解压目录
[root@i-h0xe1oiq data]# cd Python-3.11.0a1
-
编译安装
[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"时表示安装成功
-
验证
[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)