How to make Python program run in 32 and 64 bits

Asked

Viewed 2,106 times

1

I have a program made in Python(3.5) under 64 bit operating system, there is the possibility of I make it run in 64 and also in 32 bits in windows?

NOTE: I used Pyinstaller to compile the program to run on windows machines that do not have python installed.

  • If it is 100% written in Python without dependencies from external Apis will run smoothly, you have to give more details to know where your problem is.

  • This my program I compiled using Pyinstaller, because I want it to run without having python installed on the user’s machine. And it actually runs normally, but only if the user’s machine is 64 bit, if it’s 32 bit it doesn’t run.

  • If you compile for 32bit on windows it will run on 32 and 64, if you compile for 64bit it will only run on 64. If it is on Linux then you have to create an executable for each one.

  • Hmmm that Zica, I will create a virtual machine then with win 32 bit to be able to compile and test. Thanks for the tip.

  • No need for a virtual machine, just install the pyinstaller for 32bit

1 answer

1


  • If you create the 32bit executable for Windows it will run on windows32bit and windows64bit.

  • If compiling for Windows 64bits will only run on 64bits

  • If it is on Linux then you have to create an executable for each distro (debian, Fedora, etc) and for each type of processor.

Just for the record Python is not compiled, which the Pyinstaller creates is a "standalone" executable with the full python application plus its .py (or a Bytecode of it, I do not know the core to state in detail)

programa standalone gerado

See that the python.exe and the .pyd go along.

Windows

If it is a Windows-only executable just install the Pyinstaller for Windows 32bit (x86), I believe that for this you must first install Python for windows-32bit and then install the pip on it, then install:

pip install pyinstaller

Be careful that if you have multiple versions of Python it is best to point out the entire Python path before running pip and the pyinstaller, recommend you read this: PIP work-with-Multiple-versions-of-python-installed-in-Parallel

  • Okay, I’ll try here then installing the 32 bit python, thank you.

  • Yes they will, but if I use at the end of the command the "-onefile" it compiles everything inside the executable, then everything is inside.

  • 1

    I managed to run on 32 and 64 bit now, following the tip you gave, now running cool. Thanks for the help =)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.