When I compile a file (.py) to (.exe), I receive a virus notification and delete the file?

Thái Phạm Hùng 20 Reputation points

I wrote a software in Python language on VS Code, I used the packages PySide6, sqlite3,... When I compiled it into an executable file using the auto-py-to-exe package, Windows Security reported that the file was is a virus (but I see many other packages still have this error). Please how to fix the above error.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,753 questions
Windows 10 Security
Windows 10 Security
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
2,804 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jing Zhou 3,430 Reputation points Microsoft Vendor


    Thank you for posting in Q&A forum.

    We suggest you try the following methods:

    Firstly, ensure that your code and the libraries used are free from any malicious behavior.

    Secondly, make sure you are using the latest versions of Python, PySide6, sqlite3, and auto py to exe. Sometimes, older versions may trigger false positives.

    In auto py to exe, try adjusting some settings, such as:

    Use the -- onefile option to package all files into a single executable file.

    Use the -- windowed option to prevent command line windows from popping up.

    Adjust the compression level appropriately to reduce the possibility of false positives.

    If it is confirmed that the file is harmless, it can be added to the exception list in Windows Security Center. But this is just a temporary solution for the local computer.

    You can add a digital signature to your executable file. Unsigned files are more likely to be mistaken for malware. You can purchase a code signing certificate and use it to sign your executable files.

    I hope these methods can help you solve the problem. If the problem persists, more specific information can be provided for further analysis and resolution.

    Best regards,

    Jill Zhou

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

0 additional answers

Sort by: Most helpful