__main__.pyinstallerimporterror 加载失败 dynlib/dll "shcore"

__main__.pyinstallerimporterror failed to load dynlib/dll "shcore"

我用pyinstaller打包一个exe文件

在我的电脑(Win 10)中可以运行正常。

但是在别人的电脑上(Win 7)显示

__main__.pyinstallerimporterror failed to load dynlib/dll "shcore".

关于shcore,我用

import ctypes
PROCESS_PER_MONITOR_DPI_AWARE = 2
ctypes.windll.shcore.SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE)

我该怎么办? 提前致谢。

SetProcessDpiAwareness 支持的最低客户端是 Windows 8.1。

并且根据PROCESS_DPI_AWARENESS

In previous versions of Windows, there was no setting for PROCESS_PER_MONITOR_DPI_AWARE. Apps were either DPI unaware or DPI aware. Legacy applications that were classified as DPI aware before Windows 8.1 are considered to have a PROCESS_DPI_AWARENESS setting of PROCESS_SYSTEM_DPI_AWARE in current versions of Windows.

您只能使用SetProcessDPIAware设置System DPI Aware