异常原因:
python调用com组件操作office将word转pdf报错如下
Traceback (most recent call last):
File "D:/wordTest/wordTest.py", line 2, in <module>
from win32com import client
ModuleNotFoundError: No module named 'win32com'
Traceback (most recent call last):
File "D:/wordTest/wordTest.py", line 2, in <module>
from win32com import client
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\win32com\__init__.py", line 5, in <module>
import win32api, sys, os
ModuleNotFoundError: No module named 'win32api'
解决方法:
安装:pywin32-221.win-amd64-py3.7.exe
找到:
http://sourceforge.net/projects/pywin32/
找到
http://sourceforge.net/projects/pywin32/files/pywin32/
中的最新的
http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/
然后去下载对应的版本安装即可。(我重启了电脑才生效)
其他方法:
python -m pip install pypiwin32