[Python] PyInstaller EXE triggers antivirus false positives on other machines — how to fix?

Discussão em 'Python' iniciado por Stack, Junho 15, 2025.

  1. Stack

    Stack Membro Participativo

    I developed a Python application and successfully converted it into an EXE file using PyInstaller (pyinstaller --onefile --noconsole). The EXE works fine on my development machine (Windows 10/11), but when I copy it to another machine, antivirus software (like Windows Defender or others) detects it as a virus or automatically deletes it.

    I tried several solutions such as:

    Building with --clean option

    Using UPX compression (and also without UPX)

    Packing the EXE inside an installer (Inno Setup)

    Submitting to Microsoft Defender for analysis

    Adding antivirus exclusions (which only works temporarily)

    Unfortunately, none of these approaches permanently solved the problem. The only solution that seems to work is buying a Code Signing Certificate, but this is very expensive for my personal/small-scale project.

    Are there any other practical ways to avoid antivirus false positives with PyInstaller-generated EXEs? Any help or advanced PyInstaller settings that can reduce detection would be highly appreciated.

    I used PyInstaller with --onefile --noconsole --clean options to build my EXE. I also tried using UPX compression and creating an installer using Inno Setup. I expected the EXE to work normally on other machines without antivirus interference. However, antivirus software (like Windows Defender) still detects and deletes the file as a virus on other computers. I was hoping to avoid these false positives without having to purchase a code signing certificate.

    Continue reading...

Compartilhe esta Página