系统相关
首页 > 系统相关> > centos8 安装python

centos8 安装python

作者:互联网

镜像:CentOS Linux release 8.5.0-13

python下载地址:Python Source Releases | Python.org

选择所需要的版本,我这里最新版本是3.10.0

第一步:安装依赖包

yum install -y gcc zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel xz-devel libffi-devel

第二步:编译安装python

[root@192 ~]# cd /opt/
[root@192 opt]# wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz
[root@192 opt]# tar xf Python-3.10.0.tgz
[root@192 opt]# cd Python-3.10.0/
[root@192 Python-3.10.0]# ./configure --prefix=/usr/local/python --enable-optimizations
[root@192 Python-3.10.0]# make && make install

第三步:配置全局环境

[root@192 ~]# echo 'export PATH=$PATH:/usr/local/python/bin/' >> /etc/profile
[root@192 ~]# source /etc/profile
[root@192 ~]# python3 -V
Python 3.10.0

 

转载于:https://blog.csdn.net/Cookie_1030/article/details/121370340

标签:Python,python,root,192,3.10,devel,安装,centos8
来源: https://www.cnblogs.com/yifengyu/p/16433399.html