Replies: 2 comments 3 replies
-
It probably would. Alas, just because people might find it useful, it does not magically make it technically feasible. Hint: your active python environment contains OS- and arch-specific binaries (starting with python shared library and its dependencies, as well as stdlib extension modules) only for that OS. And as PyInstaller only collects those binaries, this inherently means that it can create frozen applications only for the platform that matches that of the active python environment. |
Beta Was this translation helpful? Give feedback.
-
|
I do wonder who the pyinstaller users are. Do most pyinstaller users use windows, and use pyinstaller to make packages? I mean I use Linux as my primary OS, where python and pythonic tools are either easy to get, or on the system by default. When I use pyinstaller however, it is frequently in windows, to make onefile exes for other users.... My expectation is that the typical end user on a windows system is not going to be installing python, python packages, or installing my project libraries. While pysintaller does make elf binaries in linux, most all of the development I do on linux is opensource, and I've been assuming linux users, would be able to run a python program by default. Now that I think about it, that might be an oversight on my part. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Would it be useful to compile Python code from any OS to any other OS?
For instance, consider the ability to compile Python applications from Linux into a Windows executable. This capability could greatly enhance portability and streamline workflows for developers working across different platforms. While Docker can facilitate cross-platform development, sometimes native code is easier to maintain and run. One can swap machines and copy over the code for compiling but that's not really efficient.
Here’s an example inspired by Rust, utilising mingw-w64 and MSBuild:
linux$ pyinstaller --target-add x86_64-pc-windows-msvc
linux$ pyinstaller --onefile --target x86_64-pc-windows-msvc example.py
Running these commands would create example.exe on a Linux machine, located at:
~/example_project/dist/x86_64-pc-windows-gnu/example.exe
This feature would also be particularly beneficial when coding Python within Windows Subsystem for Linux (WSL):
Working Directory: /mnt/c/Users/foobar/development/python/example_project
6 votes ·
Beta Was this translation helpful? Give feedback.
All reactions