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
第四步:创建软连接
ln -s /usr/local/python/bin/python3 python ln -s /usr/local/python/bin/pip3 pip
大功告成:
转载于:https://blog.csdn.net/Cookie_1030/article/details/121370340
老铁,如果觉得本文对你有帮助,麻烦帮点个右下角的“推荐”,感谢!
本文来自博客园,作者:平行时空的旅者,转载请注明原文链接:https://www.cnblogs.com/yifengyu/p/16433399.html