pythonwindowspyinstallerwindows-defender

Issue with PyInstaller and Windows Defender


A lot of times, I start making software in Python that I try converting into an exe. There are no problems with the process itself. However, when I actually try distributing the application, Windows Defender flags it as a virus.

I looked for answers on Stack Overflow and YouTube, but none of them really helped much.

So, what I did from the very beginning was create the Python script in Visual Studio Code. I had a folder for my script and icon for the software, and within that folder lied another that I had for some assets like sounds and pictures.

Then, when I ran "pip install pyinstaller" in Command Prompt, I typed the following:

     pyinstaller --onefile -w --name "The Sleepless Drive" -i icon.ico main.py

When one of the people who tried downloading the ZIP file (check it out on https://br8blue.itch.io/the-sleepless-drive), they claimed that Windows Defender detects a virus (though there is clearly not).

Does anyone know any solutions to this issue? I have been looking for ethical fixes for a while, but I couldn't find any. If anyone does have a plausible solution, please let me know! Thanks.


Solution

  • .exe files can run any arbitrary code on your machine and therefore Windows will automatically flag any .exe files that aren't signed as potentially dangerous, no matter what they actually do. What you would need to do is code signing, answered in this question already: Signing a Windows EXE file