How to convert .py to .exe (32bit)

Viewed 948

I created an application using PyQt5, and I'm willing to convert it to a 32bit executable file (.exe) using auto-py-to-exe! I searched a lot about this and figured out that I should use a 32bit version of Python for this purpose(examples:[1],[2],[3],[4]). Since I'm comfortable with using Conda environments, I tried to make a clone from my preferred Conda environment(that contains PyQt5 and auto-py-to-exe) in this way:

set CONDA_SUBDIR=win-32
conda create --name py32 --clone python3.10
conda activate py32
conda update --all

# Then I tried to run auto-py-to-exe
auto-py-to-exe

After this, I did a transformation using auto-py-to-exe successfully. But still, I get this error on 32bit windows when I try to execute the .exe file:

Picture of the error

Now I'm somewhat disappointed about how I should achieve my goal.

Important Question: Why did I use set CONDA_SUBDIR=win-32? Because I think that command helps me clone everything with 32bit format and converts my cloned Python to a 32bit version, this helps me run auto-py-to-exe and convert my .py file to a .exe 32bit file. But it seems I'm wrong about this since I can't run the .exe file in 32bit OS.

Can you please help me how I can create a 32bit version of Python in a Conda environment and then use auto-py-to-exe to create the 32bit .exe file? (I assume that auto-py-to-exe also uses Python for running, and the 32bit version of Python influence on auto-py-to-exe result.)


Additional details:
My OS: 64bit Windows 10
But I want to run the .exe file on another machine that has 32bit Windows 10


Update:
Since I didn't get an answer about Conda environments, I tried installing 32bit Python. I achieved a 32bit .exe file with these steps:

  1. Installing Python 3.10.1 32bit using this link.
  2. Adding the Python path to the User variables and System variables: enter image description here enter image description here
  3. Then I opened cmd and installed the required packages like auto-py-to-exe (also those used in .py) using pip.
  4. run auto-py-to-exe in cmd and start converting.

The result is a 32bit .exe file that a 32bit OS can execute. But This isn't exactly what I looked for(it works, but it made me install a 32bit Python and add it to the path, which isn't what I looked for). So I write this here and hope for someone to help me do these in a Conda environment.

1 Answers

Don't use Conda environment use venv or pipenv. you can't convert conda environment .py file to exe because of its dependency.While using venv use pyinstaller. install comand - pip install pyinstaller convert command - pyinstaller --onefile -w 'filename.py' When using pipenv use auto-py-to-exe. yeah auto-py-to-exe is old, but there are no other tools.as for conda you can't do anything.

Related