Can I control the architecture (32bit vs 64bit) when building a pyinstaller executable? Can I control the architecture (32bit vs 64bit) when building a pyinstaller executable? python python

Can I control the architecture (32bit vs 64bit) when building a pyinstaller executable?


Pyinstaller produces a binary depending from the python you used to build it. So if you use python 2.7 64 bit it is not possible, as far as I know, to produce a 32 bit executable. This is because Pyinstaller archives all modules and their dependencies (dlls, pyds etc..) which are 64 bit due to the python install.

As already said it is better, because of cross compatibility issues, to build 32-bit binaries.Probably you can specify more your question.


If you are building an application and it runs fine on 32-bit Windows, there is no need to create a 64-bit version. Just create a 32-bit version and run it on both architectures. What is what WOW64 is for.

If you need to use a library or feature which is 64-bit only, just build a 64-bit version. There is no point in building a 32-bit version if the feature is 64-bit only.

The only reason to build a 64-bit and 32-bit version both, is to take advantage of increased address space of 64-bit windows. I.e. if you intend to allocate more than 1 or 2 GB of memory. An example might be an image editing application, or a data manipulation application. Then you can run on 32-bit platforms within the constraints of the platform but edit larger images or larger quantities of data on 64-bit platforms.

IOW, for your case follow the suggestion of @Velociraptors and build in 32-bit python if you are building a 32-bit exe.


If you want to build a 32-bit application on a 64-bit system and hav only a 64-bit version of Python installed, you have to install also a 32-bit version of Python. Then you have to instal pyinstaller to that 32-bit Python version as follows:

path/to/32-bit/python -m pip install pyinstaller

After that you can run the 32-bit version of pyinstaller, and thus build a 32-bit application, like this:

path/to/32-bit/pyinstaller your-app.py

On Windows 10, pyinstaller.exe is located at C:\Users\<user>\AppData\Local\Programs\Python\Python<version>-32\Scripts\pyinstaller.exe.

As you can see, the architecture of the application you want to build depends on the Python and pyinstaller versions which you are going to use to build that application. This way you can also, for instance, build an application from a Python version 2.x if you have it installed on the system.