I created a .exe out of .py by using the PyInstaller on Windows. Can this .exe run on Mac, Linux, or other platforms?
Nope. Executable formats for Windows are completely different from those used on other OSes. You might be able to run them in Linux under WINE, but they're not natively compatible with any other OS.
Checkout the answers here for linux and windows https://superuser.com/questions/216629/can-i-run-a-windows-exe-file-on-linux
As for mac, no .exe will not work.
In general, pyinstaller would have to be run on each os to make an executable specifically for that os.
Related
I am developing Python script with Selenium under Windows10.
To automation test the web, is it possible to generate a binary file to run on CentOs under Windows10 by Pyinstaller?
Or I MUST be under the same OS which I would like to run?
And I want to check, is it correct that a file generated by Pyinstaller(or any other tool?) could run on the environment without any python-installation?
It is possible that pyinstaller makes a binary in Linux:
"PyInstaller freezes (packages) Python applications into stand-alone executables, under Windows, GNU/Linux, Mac OS X, FreeBSD, Solaris and AIX."
http://www.pyinstaller.org/
However, when you try to make a package that works on CentOS, you had better make it on that CentOS.
Is there a way to compile a .py file +additional data MAC to a .exe?
auto-py-to-exe is working great when I do in on my windows laptop.
But I often work on mac when I am not at home and need to compile my .py + some other folders and files to .exe
But when I try it on MAC I always only get a MAC executable file, not for windows.
Is there a workaround for that?
from pyinstaller FAQ section
Can I package Windows binaries while running under OS X?
No, this is not supported. Please try Wine for this.
I'm trying to convert my python file to a .exe file.
The issue is, I'm using linux, and I can't use pyinstaller or cx_freeze to make .exe files from
.py.
Is there any way to do it?
I'm using Python 3.7.3 on Debian Linux.
TLDR: You can't.
You should be able to use PyInstaller to create executable files as it is compatible with Linux systems:
https://pyinstaller.readthedocs.io/en/stable/requirements.html#gnu-linux
pip install pyinstaller
cd /path/to/your/program
pyinstaller --onefile yourscript.py
However, at least for pyinstaller, there is no way to bundle an executable file for Windows on a Linux system that I know of:
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.
Source: https://pyinstaller.readthedocs.io/en/stable/operating-mode.html
Made a python script in Ubuntu, but I read that pyinstaller compiles based on the operating system, so if I compile it on Ubuntu, it'll be for Ubuntu. How can I make an executable in Ubuntu, for Windows, or do I have to export my script into my Windows OS and compile it there?
From PyInstaller’s documentation:
If you need to distribute your application for more than one OS, for example both Windows and Mac OS X, you must install PyInstaller on each platform and bundle your app separately on each.
So, yes, you generally must run PyInstaller on the operating system the emitted binary will be run on. The documentation does suggest using a virtual machine and that running PyInstaller with WINE may work.
I am using Pyinstaller on Kali Linux 2 to create .exe to run on Windows XP.
So far, pyinstaller is successful at creating .exe that works on Kali Linux, but not Windows
Here is the python code
import webbrowser
webbrowser.open('http://www.cnn.com')
This is the command I ran on Kali Linux
~/Downloads/PyInstaller-3.2/pyinstaller.py --onefile --windowed --noupx open.py
When I open the resulting open.exe in Kali, it opens www.cnn.com. But if I email this attachment and open in Windows XP, it asks
When I save and try to execute, it says ..... How to troubleshoot this?
And when I click open is shows following. How to make it open with double-click?
From the PyInstaller documentation:
If you need to distribute your application for more than one OS, for example both Windows and Mac OS X, you must install PyInstaller on each platform and bundle your app separately on each.
So, to make an app which runs on Windows, you have to create it using PyInstaller on Windows.
Rafalmp is correct you must use a Windows machine to compile it. Alternatively you can use Wine, if you didn't have access to a Windows machine.
For more info please refer to Pyinstaller FAQ
Windows Defender assumes that externally sourced executables, especially those without cryptographic signature, may be malware. Try clicking "Open."