All I want is to convert my .py file into an .exe file but my PC is always deleting the finished .exe file when i use the preset of auto-py-to-exe to hide the cmd window which usually comes up when the .exe file gets started because it thinks the .exe file is or contains a virus. In general: Every time I try to hide the cmd window the .exe file gets detected as a virus.
I tried to use auto-py-to-exe to convert my .py file into an .exe file. And it actually works right as long as I don't choose to hide the cmd window, which always comes up if not specifically forbidden. Means: When I select the option to hide the cmd window before I convert it into an .exe file all my antivirus programs (Windows Defender and Avira) instantly ring all their alarms and delete the file on their own before i can do anything.
I also tried to do it with pyinstaller itself (I know auto-py-to-exe is based on it but i thought it couldn't hurt to try). There it is the same problem. As soon as i tell it to hide the command window when starting the program the .exe file gets detected as a virus (specifically a Trojan). In other words:
pyinstaller filename.py --onefile
works as intended. I get the .exe and everything works fine. But as soon as i use
pyinstaller filename.py -w
or
pyinstaller filename.py --noconsole
the virus alert goes off as soon as the .exe is created.
I also tried to use Nuitka and py2exe. But it didn't work as well and now i am all out of ideas.
I use Python 3.10
Does anyone know how to create a .exe file which hides the cmd window without causing a virus alert? I want to run it not only on my computer but also on my friends' PCs and i don't want them to get virus alerts (It is a management program supposed to make life easier for us. Not a virus.) Many thanks to everyone in advance!
This is a known issue with PyInstaller, many anti-virus programs detect programs made with it as false positives. Either build it with the console, or:
Add the folder the built app is in as an exception.
https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26
Submit a report to Microsoft Anti Virus saying it is a false positive, they can then fix it.
https://www.microsoft.com/en-us/wdsi/filesubmission
You can use VirusTotal to scan your file and see which anti-virus software is picking it up as a virus, it can also prove it is a false positive.
https://www.virustotal.com/gui/home/upload
False positives with PyInstaller have been around for years, the amount has decreased recently, but its still an issue because of the way PyInstaller builds applications.
You can also try other methods, such as CxFreeze.