3

I have a Python project that I want to convert into an executable. I have installed Pyinstaller. I only know how to convert one single script into .exe, but I have multiple packages with multiple python scripts.

Isabela
  • 37
  • 1
  • 3

3 Answers3

1

The command line I used with success is:

pyinstaller --noupx --onefile --add-data="cprofiles.ui;." cprofiles_lmfit.py

pyinstaller manages relatively well the multiple '.py' files that you import, no need to cite them. Under the 'add-data' option, you list the non-py files and in my example, the 'cprofiles_lmfit.py' file is the one containing the main.

But as indicated here need help to compile python with pyinstaller (and in few other posts), I am a beginner with pyinstaller. I was never able to use the 'theano' module and I did not optimize. I still have to test the suggestions in the answer.

Stéphane
  • 1,389
  • 3
  • 13
  • 34
-1

Converting the main script into .exe should solve the problem, use -onefile to convert it to one exe and rest of the .py files should be included.

XaMi
  • 47
  • 3
-1

1) Open the command prompt

2) Install pyinstaller Pip install pyinstaller

3) Test your python script first just to check python script should work with normal .py extension. Saurabh is the name of python file python saurabh.py

4) Convert the python into executable file pyinstaller --onefile Saurabh.py

Notice we have passed “–onefile” as a argument which tell pyinstaller to create only one file

5) Go to directory and navigate to the dist folder.

Prerequisite : Install PyQt5 to avoid error. pip install PyQt5

Saurabh Kukreti
  • 119
  • 1
  • 6
  • Question specifies WHOLE PROJECT not ONE SCRIPT. Question also denotes that user knows how to use `--onefile` and is not trying to do that. – Seth Feb 05 '21 at 18:23