Error when creating executable file with pyinstaller

I was haunted with similar issue. It might be that in your case UPX is breaking vcruntime140.dll. Solution to this is turning off UPX, so just add --noupx to your pyinstaller call.

pyinstaller --noupx --onedir --onefile --windowed get.py

Long explanation here: UPX breaking vcruntime140.dll (64bit)


I have also met this issue, and the root cause is that I am using upx to compress the file size. The solution is to exclude files which should not be compressed by upx:

pyinstaller --onefile --console --upx-dir=/path/to/upx --upx-exclude=vcruntime140.dll --upx-exclude=python36.dll my_script.py