linux - 如何为Redhat 5.8/CentOS 5编译python3.6程序?

标签 linux python-3.x pyinstaller centos6 glibc

我已经使用pyinstaller在CentOS 6.8上编译了python3.6程序,并在较新版本的Linux上进行了测试。它按预期工作。 CentOS 6.8已安装GLIBC 2.12

pyinstaller --onefile --clean --hidden-import sqlite3 --hidden-import pycryptodome my_python.py

但是,由于安装了 GLIBC 2.5,所以在 Redhat 5.8 上执行编译的程序时出现以下错误

[24522] Error loading Python lib '/tmp/_MEIl16Rvq/libpython3.6m.so.1.0': dlopen: /lib64/libc.so.6: version `GLIBC_2.7' not found (required by /tmp/_MEIl16Rvq/libpython3.6m.so.1.0)

您能帮我在 CentOS 6 for Redhat 5.8 上编译 python3.6 程序吗?

P.S:我无法更新 GLIBC,因为我要将相同的程序分发到许多 Linux 服务器。

最佳答案

此问题的答案列在 pyinstaller's FAQ 中作为 GNU/Linux 部分的第一个。这是我强调的一个精简版。

The executable that PyInstaller builds is not fully static, in that it still depends on the system libc. Under Linux, the ABI of GLIBC is [...] not forward compatible. [...] The supplied binary bootloader should work with older GLIBC. However, the libpython.so and other dynamic libraries still depends on the newer GLIBC. The solution is to compile the Python interpreter with its modules (and also probably bootloader) on the oldest system you have around, so that it gets linked with the oldest version of GLIBC.

关于linux - 如何为Redhat 5.8/CentOS 5编译python3.6程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51767076/

相关文章:

linux - 检查域是否在服务器上处于事件状态

linux - 在文本文件中存储变量的 Linux 命令是什么

python -/lib64/libc.so.6 : version `GLIBC_2.14' not found - error from the application build using pyinstaller

python - 使用 PyInstaller onefile 选项和 list 将 UAC 设置为 requireAdministrator

python - PyInstaller 生成的可执行文件在 MacOS X 上的代码签名不被接受

Linux 核心转储太大!

c - 如何在 sync/fsync/syncfs 到可移植设备后确保数据完整性

python - 将项目放到 QComboBox 上?

python - 类信息类型列表

python - 如何用堆叠在 numpy 数组中的一组图像制作电影?