问题描述
今天,在 Quora 上冲浪时,我遇到了 答案 关于 python 可以做的惊人事情.我尝试使用 pyttsx 文本到语音转换器,这给了我一个 No module named Win32com.client
错误.
关于这个错误有很多答案,但大多数都不够(至少对我来说),因为提议的解决方案不符合要求.
对于初学者,我使用的是 Python2.7,并且 C:/Windows/System32
中没有 DLL 或与我的 C 中的关键字pywin32"相关的任何脚本:/Python27/Scripts
文件夹.我需要一个具体的解决方案.
这是我迄今为止尝试过的:
>>>导入pyttsx>>>引擎 = pyttsx.init()回溯(最近一次调用最后一次):文件<stdin>",第 1 行,位于 <module>文件C:\Python27\lib\site-packages\pyttsx\__init__.py",第 39 行,在 init 中eng = 引擎(驱动程序名称,调试)文件C:\Python27\lib\site-packages\pyttsx\engine.py",第 45 行,在 __init__ 中self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)文件C:\Python27\lib\site-packages\pyttsx\driver.py",第 64 行,在 __init__ 中self._module = __import__(name, globals(), locals(), [driverName])文件C:\Python27\lib\site-packages\pyttsx\drivers\sapi5.py",第 19 行,在 <module> 中导入 win32com.client导入错误:没有名为 win32com.client 的模块解决方案:从此链接安装软件包.根据您的 Python 安装类型(32/64 位)选择 32/64 位版本.
我遇到了同样的问题.我从 此处 安装了 pywin32(根据您的喜好下载构建).我下载了我的 python 版本(32 位).
安装后我可以导入 win32com.client
导入 win32com.client
Today, while surfing on Quora, I came across answers on amazing things that python can do. I tried to use the pyttsx Text to Speech Convertor and that gave me an No module named Win32com.client
error.
There are many answers on this error but most of them weren't sufficient enough (Atleast for me) as the proposed solutions didn't matched the requirements.
For starters, I'm using Python2.7, and there are no DLLs in the C:/Windows/System32
or any Scripts related to the keyword 'pywin32' in my C:/Python27/Scripts
Folder. I need a concrete solution.
This is what I have tried so far:
>>> import pyttsx
>>> engine = pyttsx.init()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\pyttsx\__init__.py", line 39, in init
eng = Engine(driverName, debug)
File "C:\Python27\lib\site-packages\pyttsx\engine.py", line 45, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Python27\lib\site-packages\pyttsx\driver.py", line 64, in __init__
self._module = __import__(name, globals(), locals(), [driverName])
File "C:\Python27\lib\site-packages\pyttsx\drivers\sapi5.py", line 19, in <module>
import win32com.client
ImportError: No module named win32com.client
SOLUTION: Install the package from This Link. Choose the 32/64 bit version depending on your Python installation type (32/64 bit).
I had the same problem. I installed pywin32 from here (download the build as per your preference). I downloaded for my python version (32 bit).
After installing I was able to import win32com.client
import win32com.client
这篇关于使用pyttsx包时No module named Win32com.client报错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!