Pyinstaller error loading python DLL

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Pyinstaller error loading python DLL

Clayton Merkle
Hello, I am currently trying to build a standalone executable for a PyQt5 GUI application on a Windows 10 machine. The executable builds and runs fine on the machine on which it was built, but when I move the exe file to another windows machine and attempt to run it, I get the following error:

Error loading Python DLL
LoadLibrary: Access is denied.

The weird thing is I only receive this error when I try to run the exe file from certain directories. For example, I get this error if I run the exe from my Documents folder, but it runs just fine from the Desktop. However, when I sent the executable to a coworker, he received this error no matter where he ran it from.

Also, if I change the runtime tempdir to ‘.’ So the _MEI folder unpacks in the directory where the exe is located rather than the %temp% folder it works fine.

The machines that we use are enterprise machines with a lot of security measures, and we do not have administrator privileges, so that could be part of the problem, however once again on my machine the exe runs successfully from some directories which makes me think it may not be a permissions issue. I am building the executable with the following command:

pyinstaller --windowed --clean "PyFatigue.spec"

My .spec file is as follows:

# -*- mode: python -*-
import sys
import os
site_packages = next(p for p in sys.path if 'site-packages' in p)
block_cipher = None
a = Analysis([''],
for d in a.datas:
    if '_C.cp37-win_amd64' in d[0]:
pyz = PYZ(a.pure, a.zipped_data,
exe = EXE(pyz,
          icon='icons/python-logo.ico' )

Please help me resolve this issue. Thank you

You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit