Error loading python27.dll error for pyinstaller

You put that code snippet right at the top of the Python script you are turning into an executable - not in the spec and not in its own script. I found an example here:

https://shanetully.com/2013/08/cross-platform-deployment-of-python-applications-with-pyinstaller/


I found same error after creating a standalone executable like this:

pyi-makespec.exe -F program.py
## Customize script.spec just created

and

pyinstaller.exe -F script.spec

so I needed to run the executable as administrator to solve it.

I don't know the reason because it wasn't my computer. I had done the process in mine first and worked like a charm but not there. Perhaps some security configuration or a weird installation of python or wxpython, but I add this solution here because I was looking for hours without success, and it's a simple task that can save you some time before trying more complex approaches.


Having the same issue on python3.7 on windows 10.

Fixed this by adding --upx-exclude"vcruntime140.dll" option.

More info can be found here