0

I am trying to convert my python program to exe using pyinstaller

My files name is main.py

I want no console, so i used -w flag, but it is not working.

I am using the command pyinstaller --onefile -w main.py

It gives me 3 folders and one .spec file as in the attached picture.

Among these the dist folder if empty, build contains a main folder and __pycache__ has main.cpython-39 in it [which when I run gives a console(not required) along with the gui].

I am on windows 10 64-bit operating system with python 3.9.0 and pyinstaller 4.3

Any idea what i am doing wrong?

Thank You

It is giving the following error:

 PyInstaller does not include a pre-compiled bootloader for your platform.

Link to code is here: https://github.com/EzyGrip/Calculator/blob/main/main.py

Edit: I just discovered that this error occurs only when I try to hide the console.

Utpal Kumar
  • 300
  • 2
  • 13

3 Answers3

0

You can try

pyinstaller --noconfirm --onefile --windowed -hidden-import tkinter --noconsole  "Insert your file path here ex - C:/foldername/main.py"
  • For this command it generates only one folder `__pycache__` as before – Utpal Kumar May 07 '21 at 15:35
  • can u let us know what are imports you are doing & are you trying to add any external file , also just drag & drop your file to cmd terminal & let us know if you getting any error –  May 10 '21 at 06:53
  • This is the link to the code [link](https://github.com/Utpal-tech/Calculator/blob/main/main.py) and no there are ***NO ERRORS*** when I drop the file in cmd terminal. @LpT – Utpal Kumar May 10 '21 at 07:26
0

The problem maybe related to your antivirus software. The fact that Pyinstaller writes directly in an EXE file is viewed as a virus attack and is blocked by some systems. I have not been able to track down the reason for the single file version being blocked, but the "folder" install version... along with every other compiler and install builder in the world... is not.

There is a discussion on this issue over here: Program made with PyInstaller now seen as a Trojan Horse by AVG

codingCat
  • 2,396
  • 4
  • 21
  • 27
0

try this

pyinstaller --noconfirm --onedir --console "folderpath/filename.py"

using your code link I was able to create exe if issue persists try to update pyinstaller

also make sure python version is 3.6-3.9

  • As mentioned in question my python version is 3.9 and pyinstaller version is 4.3. Also the command mentioned in your answer created an exe but in a folder and with a console which are not desired. The desired result is an executable in one file and without console. – Utpal Kumar May 10 '21 at 12:08