问题
I am using Python 3.6.7 in conda 4.5.12 (Win10,64bit) and I want to compile my Python project to an .exe-File using Pyinstaller (3.5 dev). I keep getting the same error:
ModuleNotFoundError: No module named 'win32api'
[65600] Failed to execute script pyi_rth_win32comgenpy
I already reinstalled pywin32 as recommended in 25314463, the import of win32com works. I also tried:
pip install pypiwin32
as described in 21343774. The Installation was successful. But I still get the same Error.
pip install pywin32
from 827 does not solve the problem either. Also I tried to import win32api, win32com and pywin32 in my .spec-file with the matching paths, but still no success.
How can this error be fixed?
回答1:
Sometimes it happened to me on Windows that installed package is not visible. Try first uninstalling it:
pip uninstall pypiwin32
Make sure it has been removed:
pip list
Then install from scratch:
pip install --no-cache pypiwin32
Make sure it is installed:
pip list
You might see pywin32
in the list.
回答2:
Just pypiwin32
didn't do it for me. It worked only when I uninstalled all libs related to pywin32 and then installed again
来源:https://stackoverflow.com/questions/54149838/no-module-named-win32api-py2exe