Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can 64-bit python create 32-bit Windows executables

Tags:

I have a new 64-bit Windows machine and use python for various things and so would prefer to install 64-bit python.

However, one of my python projects creates a Windows executable that is then run on a 32-bit Windows machine (created using py2exe).

How do I use 64-bit python and py2exe to create a 32-bit executable?

If I can't do that, I guess my choices are:

  1. Use 32-bit python on all machines including mine; or

  2. Install python on the 32-bit machines and don't use py2exe.

Any advice much appreciated.

like image 613
blokeley Avatar asked Feb 08 '11 16:02

blokeley


People also ask

Will 64-bit Python work on 32-bit?

This is actually a fine choice: you don't need the 64-bit version even if you have 64-bit Windows, the 32-bit Python will work just fine.

Can a 64-bit processor run 32-bit programs?

In general, you can surely run 32-bit software on a 64 bit PC. All 64 bit systems are compatible with 32-bit programs relying on WOW64, which is the x86 emulator that enables 32-bit Windows-based programs to run seamlessly on 64-bit Windows.


1 Answers

You can install both 32 and 64 bit Python on the machine and use the py2exe associated with each installation.

However, unless you actually need the extra address space of 64 bit, then you may as well just stick to 32 bit Python for compatibility. You may well find that 3rd party modules will have better availability if you are using 32 bit.

Update: Three years have passed since I wrote this. Would I stick to the advice about 64 bit Python? Probably. It is certainly true that 64 bit third party modules are easier to come by. Not least thanks to Christoph Gohlke's wonderful site.

But it is still the case the every now and again you'll find it hard to get a 64 bit version of an extension that you need. So, if your program works perfectly well in a 32 bit process, then it is perfectly sound to stick to 32 bit.

like image 199
David Heffernan Avatar answered Sep 19 '22 12:09

David Heffernan