Making a 32 bit .exe from PyInstaller using PyCharm

Answered

I have a 64 bit PC, and python 3.6.2 (64 bit), python 3.5.4 (32 bit), and python 3.5.4 (64 bit), all installed and added to my path.

In Pycharm, I created a virtual environment based off of python 3.5.4 (32 bit) and wrote a project in this env. Each version of python I have installed has an associated virtual env, and all of them have pyinstaller installed on them via Pycharm's installer.

However, when I open up a command prompt in the project folder and type

pyinstaller -F project_name.py

it spits out a .exe that only runs on 64 bit machines. Everything is tested and works perfectly well on 64 bit PCs, but I get an error on 32 bit PCs asking me to check whether or not the system is 32 bit or 64 bit.

How can this be possible, and how do I fix it?

EDIT: It seems as though pyinstaller is accessing the python35 folder instead of the python35-32 folder when running. How do I stop this?

1
2 comments
Avatar
Permanently deleted user

What happened in my case was that paths for both 32 and 64 bit python installations were in my Path environmental variable, but the 64bit paths were listed first and then 32 bits. I made it work by changing the orders of these two. Pyinstaller seems to go with the paths it finds first looking top-down. After creating 32-bit executable I just reordered the paths back to my 64-bit default.

You can check which exe is created by running it and locating the task in the Task Manager (ctrl+alt+del): the 32 bit process will have "(32-bit)" appended to the process name, 64 bit exe will just have the process name without any appendages. 

0

Hi Avasatu,

Have you tried to run it from the command line (outside of PyCharm) using the same interpreter? Do you have the same error?

0

Please sign in to leave a comment.