简体   繁体   中英

win32 Python - pythoncom error - ImportError: No module named pywintypes

I am trying to import pythoncom, but it gives me this error: Traceback (most recent call last): File "F:/Documents and Settings/Emery/Desktop/Python 27/Try", line 2, in import pythoncom File "F:\\Python27\\lib\\site-packages\\pythoncom.py", line 2, in import pywintypes ImportError: No module named pywintypes

I reinstalled Python win32, but it still doesn't fix it. Any help? Also, I am trying to access the pythoncom.PumpMessages() method, an alternative would be nice as well.

If you are using an IDE like I am (PyCharm), you should go the where the Python is installed eg C:\\Users\\***\\AppData\\Local\\Programs\\Python\\Python37\\Lib\\site-packages

In this folder check for the folder name pywin32 . Copy that folder and paste it to C:\\Users\\***\\PycharmProjects\\project\\venv\\Lib\\site-packages . After that restart your IDE, then it will import the pywin32 as it did in my case. I hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM