2

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.

1 Answer 1

1

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:

  1. Run the OS virtually and, create executable in that virtual os and export it later.
  2. 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/
Sign up to request clarification or add additional context in comments.

2 Comments

If I understand correctly, without a virtual machine, there is a way to create a windows executable on Linux but there is not for Mac executables?
@Phineas Exactly, this is annoying. I guess a tool that can do it cross-platform could be extremely useful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.