linux7安装python3.12.1教程

2023-12-14 10:15:28

1.下载tar.gz包? ?地址:Python Release Python 3.12.1 | Python.org

2.上传包到linux服并解压

cd /home/local/
ll
tar -zxvf Python-3.12.1.tgz

3.安装编译python所需环境

yum install -y gcc
yum install -y zlib*
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

4.编译python并指定安装目录

cd Python-3.12.1/
./configure --prefix=/usr/local/python3 --with-ssl
make
make install

# 在usr/bin创建指向usr/local/python的软链接
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

5.查看python版本

python --version
python3 --version

文章来源:https://blog.csdn.net/cherishSpring/article/details/134914923
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。