Python 官方文档:入门教程 => 点击学习
1.下载python包 wget https://www.Python.org/ftp/python/3.9.10/Python-3.9.10.tgz 2.下载python3编译的依赖包 yum install -y
1.下载python包
wget https://www.Python.org/ftp/python/3.9.10/Python-3.9.10.tgz
2.下载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
3.解压缩源码包
tar -zxvf /usr/local/software/tars/Python-3.9.10.tgz
4. 创建python的安装目录
mkdir -p /usr/local/software/python
5.移动解压后的Python源码包到python目录
mv /usr/local/software/tars/Python-3.9.10 /usr/local/software/python
6.进入解压后的目录并且执行
cd /usr/local/software/python/Python-3.9.10./configure --prefix=/usr/local/software/python/ # 指定安装目为/usr/local/software/python/
7.编译
make
8.编译安装
make install
9.添加linux环境变量 使用root账号
vi /etc/profile在末尾添加#pythonPATH=/usr/local/software/python/bin:$PATH保存后 执行source /etc/profile
10.修改python的链接指向
mv /usr/bin/python3 /usr/bin/python3.bakln -s /usr/local/software/python/bin/python3 /usr/bin/python3
到此这篇关于在Centos下安装python的文章就介绍到这了,更多相关Centos安装python内容请搜索我们以前的文章或继续浏览下面的相关文章希望大家以后多多支持我们!
--结束END--
本文标题: 在Centos下安装python
本文链接: https://lsjlt.com/news/201658.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0