问题描述
我正在尝试导入pythoncom,但是它给了我这个错误:Traceback(最近一次通话是最后一次): 文件"F:/Documents and Settings/Emery/Desktop/Python 27/Try",第2行,在 导入pythoncom 文件"F:\ Python27 \ lib \ site-packages \ pythoncom.py",第2行,在 导入pywintypesImportError:没有名为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 pywintypesImportError: No module named pywintypes
我重新安装了Python win32,但仍无法解决.有什么帮助吗?另外,我正在尝试访问pythoncom.PumpMessages()方法,也可以选择一种替代方法.
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.
推荐答案
如果您使用的是我(PyCharm)这样的IDE,则应转到安装Python的位置,例如C:\Users\***\AppData\Local\Programs\Python\Python37\Lib\site-packages
If you are using an IDE like I am (PyCharm), you should go the where the Python is installed e.g C:\Users\***\AppData\Local\Programs\Python\Python37\Lib\site-packages
在此文件夹中检查文件夹名称pywin32
.复制该文件夹并将其粘贴到C:\Users\***\PycharmProjects\project\venv\Lib\site-packages
.重新启动您的IDE之后,然后它将导入pywin32
,就像我的情况一样.希望对您有帮助.
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.
这篇关于win32 Python-pythoncom错误-ImportError:没有名为pywintypes的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!