0

I installed pyttsx3 with the pip install pyttsx3 command, then when I run this program an error comes up.

The program :

import pyttsx3
engine = pyttsx3.init()

rate = engine.getProperty('rate')
print (rate)
engine.setProperty('rate', 125)

volume = engine.getProperty('volume')
print (volume)
engine.setProperty('volume',1.0)

voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)

engine.say("Hello World!")
engine.say('My current speaking rate is ' + str(rate))
engine.runAndWait()
engine.stop()

The error :

raise ImportError("No system module '%s' (%s)" % (modname, filename))
ImportError: No system module 'pywintypes' (pywintypes37.dll)

I hope you can help me...

Noé
  • 320
  • 2
  • 14

1 Answers1

0

What version of pytts3 or python you are using? Try to reinstall or update the pyttsx because this code works perfectly on my machine you can check the output here

Uninstall the current pyttsx3 with pip uninstall pyttsx3

Then install it again. Also update your python version.

Hi, Noe so the problem is you have installed multiple versions of python in single system, In case you have more than one python version installed on your system you have two choices:

1.As only one interpreter can be the default application for Python file types, So you should have to change the python interpreter from the IDE you are using and then install the pyttsx.

2.you can install it by creating the virtual environments. create a virtual environment with latest python version, activate your virtual environment and then install the pakage in the environment. If you are using anaconda follow the following commands:

conda create --name env_name python=3.9

activate env_name

Or if you are using python default ide you can check This link to create virtual environments.

rahul
  • 53
  • 4
  • I found out that pyttsx3 was installed in the python3.7 file. And when I run python on cmd, it runs python 3.7, even though I installed python 3.9. How could I tell pip to install it in python 3.9 ? – Noé Nov 11 '20 at 09:00