Can't load pywin32 library win32gui

半腔热情 提交于 2019-11-26 23:31:02

问题


I'm trying to use the win32gui module included with pywin32 but I can't get it working.

I have downloaded it, built it and everything seem to be located under site-packages, I've found win32gui.pyd at site-packages/win32/win32gui.pyd but when I try to import it I get:

import pyHook, win32gui
ImportError: DLL load failed: The specified module could not be found.

Do I need to move a dll somewhere? and if so, which one?


回答1:


My guess is that win32gui depends on some DLL that is not on your system. You can download depends and see what you're missing.

However my first attempt will be try installing pywin32 from the installer, not by building it.




回答2:


This works:

import pywintypes
#import pythoncom # Uncomment this if some other DLL load will fail
import win32gui



回答3:


I had the same issue. I added the path where pywintypes34.dll to system path and it worked.

In my case it was C:\Python34\Lib\site-packages\pywin32_system32




回答4:


First check that "pywin32" module is installed in your system or not. If not installed then install it first. http://www.lfd.uci.edu/~gohlke/pythonlibs/#pywin32

If the issue still persists then now for the /Lib/site-packages/pywin32_system32 and add this path to system library or add pythoncom35.dll and pywintypes35.dll to the directory which is added to a system path.




回答5:


I tried to only "copy" pywin32 package once instead of installing it and it works well.

what i've done is :

  1. Copy over all the related packages to site-packages folder
  2. Copy pythoncom25.dll & pywintypes25.dll to c:\windows\system32 folder (you might need to change to version&system path)

Hope it helps




回答6:


Same problem, I installed from sourceforge and then I run the .exe as administrator.



来源:https://stackoverflow.com/questions/3956178/cant-load-pywin32-library-win32gui

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!