Skip to content Skip to sidebar Skip to footer

How To Prevent Exe Created By Pyinstaller From Being Deleted By Antivirus?

I have converted a python project into an exe file using pyinstaller. The basic functionality in the python project is to read files, parse the file contents, and write them into a

Solution 1:

In issues on GitHub mentioning 'virus' in the PyInstaller repo htgoebel repeatedly states:

Please contact you anti-virus vendor. There is nothing we can do about this false positive.

If your anti-virus vendor considers one of the files included in the PyInstaller distribution or a file generated by PyInstaller to be malicious, there is nothing we can do about this. Even if we'd change our code, they'd change their pattern and the race starts again.

See this mailing-list thread and other tickets for his topic.

So when asking "How to handle this situation?", there isn't much you can do. Like htgoebel said, you can't control what anti-virus vendors match and changing what/how PyInstaller outputs will just be matched to be flagged again later.

You possibly could change to a different anti-virus vendor but that may be out of your control and you'll still have the issue when the package is distributed.

Solution 2:

PyInstaller does seem to be the most popular choice for converting a python script into an exe, but there are other choices:

How do I convert a Python program to a runnable .exe Windows program?

When I wasn't able to get around this problem in PyInstaller, I looked for a different tool. I chose cx-freeze over py2exe simply because it had more recent commits on github. It worked great:

python -m pip install cx_Freeze
python -m cx_Freeze test.py
cd build\exe.win-amd64-3.10
test.exe

Output:

Hello world

In case the PyInstaller devs care, my anti virus is CrowdStrike Falcon.

Post a Comment for "How To Prevent Exe Created By Pyinstaller From Being Deleted By Antivirus?"