侧边栏壁纸
  • 累计撰写 31 篇文章
  • 累计收到 0 条评论

Centos安装python

admin
2023-12-17 / 0 评论 / 28 阅读 / 正在检测是否收录...

1.下载python3编译的依赖包

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

2.下载python包

wget https://www.python.org/ftp/python/3.12.3/Python-3.12.3.tgz

3.解压缩源码包

tar -zxvf Python-3.12.3.tgz

4.创建python的安装目录

mkdir -p /usr/local/python3

5.进入解压后的目录并且执行

cd Python-3.12.3
./configure --prefix=/usr/local/python3/

6.编译并安装

make && make install

7.添加环境变量

vi /etc/profile

在末尾添加

PATH=/usr/local/software/python/bin:$PATH

保存后执行

source /etc/profile

8.修改python的链接指向

mv /usr/bin/python3 /usr/bin/python3.bak
ln -s /usr/local/python3/bin/python3 /usr/bin/python3

转载自:https://blog.csdn.net/weixin_41133459/article/details/125316142

0

评论

博主关闭了所有页面的评论