Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pyinstaller, how to make 32bit and 64bit .exe on 32bit linux?

I created executable using pyinstaller 2.0 and python2.7 on ubuntu 12.04 32bit (so I assume python is also 32bit).

It's a simple program in console (no gui), that connects to TCP/IP server and send frames. It works under my ubuntu 32bit, but it does not run on Windows 7 32bit and 64bit. On Win32bit it returns error "Device is not ready", and on Win64bit it returns error that "application has wrong architecture".

Where can be cause of this?

Here is a link to whole app code (it's small) http://pastebin.com/qj96vpgK

like image 279
Rafał Łużyński Avatar asked Sep 26 '12 09:09

Rafał Łużyński


People also ask

Does PyInstaller work on Linux?

PyInstaller supports Python 3.7 and newer, and correctly bundles many major Python packages such as numpy, matplotlib, PyQt, wxPython, and others. PyInstaller is tested against Windows, MacOS X, and Linux.


1 Answers

The Linux version of PyInstaller can not make .exes or any non-Linux-native format. In order to make a Windows executable, you need to either use WINE (or at least they say, but I'm not sure how to do that), or use a Windows computer.

Additionally, if the Windows computer you use is 32-bit, it can not make 64-bit binaries. If you have a 64-bit install of Windows, it can make 64-bit binaries easily, but in order to make 32-bit ones, you need to install a 32-bit version of Python (and all the required libraries for your program).

Thus, one way to make both 32- and 64-bit executables for a given program, copy your code over to a Windows 64-bit OS, install the 32 and 64-bit Python and pywin32, and use PyInstaller using each different Python.

like image 171
Piccolo Avatar answered Sep 18 '22 05:09

Piccolo