.py to only one .exe file

Viewed 279

I know that pyinstaller can convert .py file into .exe, but at the same time you will have some folders, so without them your .exe file will not work. Is it possible to convert .py file into only one .exe file?

4 Answers

You can use auto-py-to-exe for more advanced conversion settings:

$ pip install auto-py-to-exe
$ auto-py-to-exe

Then a window will open and you are going to be able to convert your file.

You can run the below command line is if

  1. you want to make it a onefile
  2. if you want to get rid of the console
  3. if there are any external data(png files, the directory is relative to your main)

pyinstaller --noconsole --onefile --add-data="icon.png;." main.py

Use something like NSIS as described in this tutorial.

Essential, zip the output you get from pyinstaller, and then run the NSIS GUI to configure and build your standalone .exe.

Related