我曾经在centos上做过Python2.7.8的编译, 也是碰到了各种问题,后来直接用人家现成的了。
之前在cpyUG邮件列表里面见过有人做类似的东西:
https://github.com/auxten/miniPyRuntime这个是基于python2.7.3的,但是它依赖于这些库:
$:ldd dist/bin/python
linux-vdso.so.1 => (0x00007fff170d3000)
libkrb5.so.3 => /lib64/libkrb5.so.3 (0x0000003a8aa00000)
libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x0000003a8ba00000)
libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x0000003a8a600000)
libz.so.1 => /lib64/libz.so.1 (0x0000003a89a00000)
libsqlite3.so.0 => /usr/lib64/libsqlite3.so.0 (0x0000003f75600000)
libbz2.so.1 => /lib64/libbz2.so.1 (0x0000003f79a00000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003f75200000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003f74e00000)
libutil.so.1 => /lib64/libutil.so.1 (0x0000003f78600000)
libm.so.6 => /lib64/libm.so.6 (0x00007f1a1bb78000)
libc.so.6 => /lib64/libc.so.6 (0x0000003f74a00000)
libcom_err.so.2 => /lib64/libcom_err.so.2 (0x0000003a8a200000)
libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x0000003a8b600000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x0000003f76e00000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003a89e00000)
/lib64/ld-linux-x86-64.so.2 (0x0000003f74600000)
可以参考一下它的裁剪方法。
PS:这个项目我没有用过。我用了之前推荐的StaticPython很长一段时间,非常稳定。