Dll 未在非开发环境中加载

问题描述 投票:0回答:0

我正在构建一个使用 dll 文件的 python 应用程序。用pyinstaller app编译成exe后,在安装了visual studioDesktop development with C++的电脑上运行良好,但抛出如下代码STREAM_API找不到dll文件的错误。我正在尝试不同的方法来设置文件的路径,并且该文件甚至存在于 /temp/ 中,并且我确实在 .spec 文件中包含了 .dll 文件

RESOURCES_DIR = os.path.join(os.path.dirname(os.path.abspath(__file_)), "resources")
_DLL_DIR = os.path.join(_RESOURCES_DIR, 'some.dll')

C_VOID_PTR = ctypes.POINTER(ctypes.c_void_p)

try:
    STREAM_API = ctypes.CDLL(_DLL_DIR)
except OSError as ex:
    raise OSError(f"{str(ex)}: {_DLL_DIR}")

如何在不使用 c++ 安装桌面开发的情况下使其工作。 erSTREAM_API

回溯

Traceback (most recent call last):
  File "PyInstaller\loader\pyimod03_ctypes.py", line 53, in _init_
  File "ctypes\__init__.py", line 376, in _init_
FileNotFoundError: Could not find module 'C:\Users\SEC\AppData\Local\Temp\_MEI166842\stream\dll_api\resources\some.dll' (or one of its dependencies). Try using the full path with constructor syntax.

DLL 是基于 32 位构建的,我使用 32 位 python 运行和编译它

python visual-studio dll pyinstaller ctypes
© www.soinside.com 2019 - 2024. All rights reserved.