Is there a way to create a python executable on Ubuntu that can also run on Mac?
Note: This executable doesn't have to run on Linux.
You can't!. Please refer to the following link:
https://dzone.com/articles/making-a-stand-alone-executable-from-a-python-scri
There it state:
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.
A workaround to solve it is:
WINE works as well! (Though, I didn’t try it myself), refer to the following link https://www.andreafortuna.org/2017/12/27/how-to-cross-compile-a-python-script-into-a-windows-executable-on-linux/