Python 在不同 linux 版本上可执行 运行

Python executable running on different linux versions

我需要编写一个最终会在 CentOS 上 运行ning 的程序(版本 6.3 - 它是一个安全设备,但我有根访问权限) 我在 Ubuntu 中安装了一个开发环境,并使用 pyinstaller 创建了一个可执行文件。在 PyCharm 中,我可以在 python 版本 2.7 和 3.6 之间 select - 我尝试了两个版本并创建了 exe。 该程序在 Ubuntu 上运行良好,但不幸的是在 CentOS 下运行不佳 CentOS 显示 Python 版本 2.66

问题: - 它应该在一般情况下工作吗? - 我收到错误-(缺少库)(但文件存在): “./ICC: /lib64/libc.so.6: 找不到版本 `GLIBC_2.14'(/tmp/_MEIoHOzeE/libz.so.1 要求)” - 我假设版本不匹配?

(相同的代码 运行 在 ubuntu 上没问题,猜想在较新的 python 版本中情况发生了变化,这是有道理的)

关于如何使这项工作有效的任何建议、想法和提示。

TIA 马丁

当您使用 PyInstaller 创建可执行二进制文件时,您必须在目标机器或目标环境上执行此操作。

The output of PyInstaller is specific to the active operating system and the active version of Python. This means that to prepare a distribution for:

  • a different OS
  • a different version of Python
  • a 32-bit or 64-bit OS

you run PyInstaller on that OS, under that version of Python. The Python interpreter that executes PyInstaller is part of the bundle, and it is specific to the OS and the word size."

更多信息可用here