How to create a python " *.exe" executable?

Asked

Viewed 44,347 times

18

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

Currently I use 3.3

3 answers

17


I’d like to record my suggestion to Pyinstaller or else cx_Freeze.

In any case none of them have to ensure that it will run on any windows desktop.

First of all if Voce is using windows 7 64 bit for example to generate the executables, they will not run on windows 7 32 bit, but otherwise.

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 and also 64 bit.

In any case it is worth testing if the program opens. It may not work on windows older than XP. Especially if your program relies on other libraries like QT.

Another promising option is the Pyoxidizer. He is younger, IE, is more modern, but is still in the development phase - immature. It is worth testing and keep an eye.

Recently I had success with the Shiv. It zips your app and dependencies that you installed with Pip in one file and uses python zipapp functionality. In practical terms, you send the user only one file, but you have to ask him to install python on the computer before running it for the first time. It’s a little inconvenient for the user, but I think it’s worth it just because the file gets much smaller. This makes life easier for everyone when updating for example.

  • 1

    but as I use cx_freeze to create the executables...I didn’t quite understand the operation of this application

12

7

pyinstaller is cool and simple to use. First you should use a package manager - probably the pip - to install it

pip install pyinstaller

After installation, just run it:

pyinstaller -w nome_do_software

Or pyinstaller do_software.py

To get the desired result.

  • There is currently a better way to convert to exe ?

Browser other questions tagged

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