在 Ubuntu 上创建一个在 Mac 上运行的 python 可执行文件

Make on Ubuntu a python executable that runs on Mac

有没有办法在 Ubuntu 上创建一个 python 可执行文件,它也可以 运行 在 Mac?

注: 此可执行文件不必 运行 on Linux.

你不能!请参考以下link:

https://dzone.com/articles/making-a-stand-alone-executable-from-a-python-scri

上面写着:

The format/extension of the executable will depend on which operating system you used for compilation. For example, if you run the PyInstaller command on Windows the executable file will be .exe. If you run it on Linux the extension will depend on the distribution you are using.

解决该问题的解决方法是:

  1. 运行 OS 虚拟,并在该虚拟 os 中创建可执行文件并稍后导出。
  2. WINE 也可以! (虽然我自己没试过),参考下面link https://www.andreafortuna.org/2017/12/27/how-to-cross-compile-a-python-script-into-a-windows-executable-on-linux/