No module named Win32com.client error when using the pyttsx package
Asked Answered
R

5

6

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).

Ranjiv answered 13/2, 2016 at 13:57 Comment(8)
you have to download and install it before it will work.Laggard
"pip install pyttsx" would normally do it, but you are on Windows, so no real idea how you use pip thereLaggard
@PaulCollingwood pip install pyttsx It's already installed. Let me post the Traceback as well.Ranjiv
try pip install pywin32Laggard
@PaulCollingwood I'm sorry, It doesn't work. Could not find a version that satisfies the requirement pywin32 (from versions: ) No matching distribution found for pywin32Ranjiv
sourceforge.net/projects/pywin32/filesLaggard
@PaulCollingwood There are 2 installers, the win32 one or the amd64 one?Ranjiv
@PaulCollingwood It WORKED!!!Ranjiv
F
8

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
Fahrenheit answered 20/3, 2016 at 9:35 Comment(0)
A
2

Since this is from some time ago and the links are a little outdated, a simple run of

pip install pywin32

will install the correct version for your environment. You should be able to run the import win32com.client without issue. Be sure to restart your kernel to see the changes.

Adjoin answered 25/7, 2018 at 15:44 Comment(0)
V
1

I also had the same problem. I solved it with the below steps:

1.Open the cmd (run it in admin mode).

2.Enter the command:

conda install pywin32 

or

pip install pywin32

I hope this works for you, it worked for me.

Vacillatory answered 11/6, 2020 at 13:28 Comment(0)
A
0

I was also going through the same issue and didn't find any satisfactory solution. Then I just followed 2 steps and Voila :)

  1. First of all, you have to download the pywin32-217.win32-py2.7 from (https://sourceforge.net/projects/pywin32/files/pywin32/Build%20217/).
  2. Then you have to install it
pip install pypiwin32

run the code again and you will get the expected output.

Anatolic answered 23/8, 2017 at 5:3 Comment(0)
O
0

Installing relevant binary from github helped me

Offoffbroadway answered 16/9, 2022 at 0:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.