简体   繁体   English

Spyder:没有名为 pywintypes 的模块

[英]Spyder: no module named pywintypes

My Spyder python version is 3.7.9.我的 Spyder python 版本是 3.7.9。 I tried to run import win32com.client as win32 then I got the error below.我尝试将import win32com.client as win32运行,然后出现以下错误。

Traceback (most recent call last):

  File "<ipython-input-1-360eab2b8977>", line 1, in <module>
    import win32com.client as win32

  File "C:\Users\abc\AppData\Local\Programs\Spyder\pkgs\win32com\__init__.py", line 6, in <module>
    import pythoncom

  File "C:\Users\abc\AppData\Local\Programs\Spyder\pkgs\pythoncom.py", line 2, in <module>
    import pywintypes

ModuleNotFoundError: No module named 'pywintypes'

I looked at the solutions here and copy and pasted files as below.我在这里查看了解决方案,并复制和粘贴了如下文件。 In my case, I copied (pythoncom38.dll + pywintypes38.dll + pythoncom37.dll and pywintypes37.dll) but still I am getting the same error就我而言,我复制了(pythoncom38.dll + pywintypes38.dll + pythoncom37.dll 和 pywintypes37.dll)但我仍然遇到相同的错误

在此处输入图像描述

I have same problem.我有同样的问题。 So, I try to remove the Spyder and re-install the Spyder via CMD then run win32com to open excel.因此,我尝试删除 Spyder 并通过 CMD 重新安装 Spyder,然后运行 win32com 打开 excel。

  • CMD input the command: CMD 输入命令:
  1. pip install wheel pip安装轮
  2. pip install spyder pip 安装spyder
  3. spyder间谍

Sample open excel样品开excel

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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