How to create an executable " *.exe" in Python?

Question:

I need to turn "*.py" files into "*.exe" executables to run on any Windows desktop.

I currently use Python 3.3

Answer:

I would like to record my suggestion for PyInstaller or cx_Freeze .

In any case, none of them can guarantee that it will run on any Windows desktop.

Firstly, if you are using Windows 7 64 bit for example to generate the executables, they won't run on Windows 7 32 bit, but the opposite will.

However, if you are using Windows 64 bit with Python 32 bit, the generated files will be 32 bit, and will work on Windows 32 bit as well as 64 bit.

In any case, it's worth testing whether the program opens. It may not work on Windows older than XP. Even more so if your program depends on other libraries like QT.

Another promising option is PyOxidizer . It's younger, that is, it's more modern, but it's still in the development stage – immature. It's worth testing and keeping an eye out.

I recently had success with Shiv . It zips your app and dependencies you installed with pip into one file and uses Python's zipapp functionality. In practical terms, you send the user a single file, but you have to ask him to install Python on the computer before running it for the first time. It's a bit inconvenient for the user, but I think it's worth it just because the file gets so much smaller. This makes life easier for everyone when it comes to updating for example.

Scroll to Top