1. 安装依赖
yum install wget zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make zlib zlib-devel libffi-devel -y
2. wget 远程下载
该页面用户获取下载地址:
https://www.python.org/downloads/release/python-3104/wget https://www.python.org/ftp/python/3.10.4/Python-3.10.4.tgz
3. 存文件解压缩
export/server 下面
tar -xvf Python-3.10.4.tgz
切换到python目录下 cd Python-3.10.4
4. 执行配置
./configure --prefix=/export/server/python3.10.4
5.编译并安装
make && make install
6.安装好以后的操作命令行
[root@node1 Python-3.10.4]
[root@node1 python3.10.4]
总用量 0
drwxr-xr-x 2 root root 202 8月 18 14:42 bin
drwxr-xr-x 3 root root 24 8月 18 14:42 include
drwxr-xr-x 4 root root 64 8月 18 14:42 lib
drwxr-xr-x 3 root root 17 8月 18 14:42 share
[root@node1 python3.10.4]
[root@node1 bin]
总用量 18676
lrwxrwxrwx 1 root root 9 8月 18 14:42 2to3 -> 2to3-3.10
-rwxr-xr-x 1 root root 119 8月 18 14:42 2to3-3.10
lrwxrwxrwx 1 root root 8 8月 18 14:42 idle3 -> idle3.10
-rwxr-xr-x 1 root root 117 8月 18 14:42 idle3.10
-rwxr-xr-x 1 root root 247 8月 18 14:42 pip3
-rwxr-xr-x 1 root root 247 8月 18 14:42 pip3.10
lrwxrwxrwx 1 root root 9 8月 18 14:42 pydoc3 -> pydoc3.10
-rwxr-xr-x 1 root root 102 8月 18 14:42 pydoc3.10
lrwxrwxrwx 1 root root 10 8月 18 14:42 python3 -> python3.10
-rwxr-xr-x 1 root root 19096000 8月 18 14:42 python3.10
-rwxr-xr-x 1 root root 3107 8月 18 14:42 python3.10-config
lrwxrwxrwx 1 root root 17 8月 18 14:42 python3-config -> python3.10-config
[root@node1 bin]
Python 2.7.5 (default, Aug 7 2019, 00:51:29)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[root@node1 bin]
/export/server/python3.10.4/bin
[root@node1 bin]
[root@node1 bin]
ln: 无法创建符号链接"./python3.10": 文件已存在
[root@node1 bin]
[root@node1 bin]
[root@node1 bin]
[root@node1 bin]
Python 3.10.4 (main, Aug 18 2025, 14:40:23) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[root@node1 bin]vi编辑器进入后
分别在
/usr/libexec/urlgrabber-ext-down
和
/usr/bin/yum
两个编辑的文件中的第一行末尾 添加数字2
保存即可
到这一步就完成linux系统的python完美安装
同时不影响yum的使用
任意位置输入python命令即可使用python命令即可使用解释器
预祝大家安装顺利!