WARNING: Several hooks defined for module ‘win32ctypes.core‘. Please take care they do not conflict

problem:

python pyinstaller packaging error:

WARNING: Several hooks defined for module 'win32ctypes.core'. Please take care they do not conflict.

Resolution process:

Install pypiwin32

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pypiwin32

The error is still reported, as shown in the following figure:
Insert picture description here

Solution:

In the end, it was found that it was caused by the package import problem. The two dependent libraries were indeed installed, but the import method was different and an error was reported.

Find a compat.py file in the Lib/site-packages/Pyinstaller directory under the python installation path and locate it to line 212

The source code is as follows:

if is_win:
try:
from win32ctypes.pywin32 import pywintypes # noqa: F401
from win32ctypes.pywin32 import win32api
except ImportError:
xxxx
xxxx

Make the following changes: change the two from to import

if is_win:
try:
# from win32ctypes.pywin32 import pywintypes # noqa: F401
# from win32ctypes.pywin32 import win32api
import pywintypes
import win32api
except ImportError:
xxxx
xxxx

It runs successfully.

Reference document: https://blog.csdn.net/weixin_32831351/article/details/111920888

Guess you like

Origin blog.csdn.net/weixin_47542175/article/details/114259934