Pyinstaller on Kali to create exe for Windows XP - python

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."

Related

How to run the .exe file in window exported from Mac machine

I am writing in Python and trying to export it as a .exe file from Mac machine. I tried to export it by auto-py-to-exe and it works well in my Mac machine. However, I found that it could not be opened in Window even I add the '.exe' after its file name. Is there any way to fix it or I can only export it in a Window machine? Thanks!
auto-py-to-exe seems to be a graphical interface for PyInstaller. According to the official PyInstaller docs
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.
You can do this from a single machine using virtualization. The free virtualBox or the paid VMWare and Parallels allow you to run another complete operating system as a “guest”. You set up a virtual machine for each “guest” OS. In it you install Python, the support packages your application needs, and PyInstaller.
So you would need to build it on a Windows or Windows VM to get it to work on Windows.

Pyinstaller Is it possible to generate binary file to run on CentOs under Windows?

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.

Can the .exe run on Mac, Linux, or other platforms?

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.

Is there a way to turn my python script (that I wrote in an Ubuntu docker image) into an executable for Windows?

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.

Pyinstaller app created on mac and cant share with Windows Users

Hello I have currently make a .app that runs perfectly I have shared it with my friends that use mac and it runs perfectly It is a PyQt5 app that I created with pyinstaller the commands I used to make it is:
pyinstaller --icon=(.....).icns --onefile --noconsole -n(.....) (the .py script) It compiles perfectly and creates the app with the icon image and opens up and all that I am able to compress it into a zip file and email it to my mac users which also runs for them without them having to install anything
But I have some window user friends that I want to share with and the .app obviously wont work (I tried to change the file name and replaces the .app with .exe) and tried to send that which doesn't work they try and run it and it says
"this app can't run on your pc To Find a version for your pc check with the software publisher"
and so I tried to compile a new app but with -F in the pyinstaller thing added to the ling of code I use in the terminal then a bunch of stuff runs in the terminal that says .exe and all that and when I drag it onto my desktop it is a .app and so I change it to a .exe again and try and share it with my window user friends and I get the same error
"this app can't run on your pc To Find a version for your pc check with the software publisher"
Can anyone help me out im really trying to get a way on how to make it run on windows computer please!
To create a Windows app the script need to be compiled in a PC with Windows. The same for Mac and Linux. This is in the manual:
PyInstaller is tested against Windows, Mac OS X, and Linux. However, it is not a cross-compiler: to make a Windows app you run PyInstaller in Windows; to make a Linux app you run it in Linux, etc. PyInstaller has been used successfully with AIX, Solaris, and FreeBSD, but is not tested against them.

Categories