Home > OS >  pyttsx3 not recognized in python 3.11
pyttsx3 not recognized in python 3.11

Time:12-17

i am trying to make a tts script and i have done

pip install pyttsx3

i have also installed the following librarys:

pywin32
comtypes
pypiwin32

my python version is 3.11

error:

Exception has occurred: ModuleNotFoundError
No module named 'pyttsx3'

if i do ```pip show --verbose pyttsx3`` i get:

Name: pyttsx3
Version: 2.90
Summary: Text to Speech (TTS) library for Python 2 and 3. Works without internet connection or delay. Supports multiple TTS engines, including Sapi5, nsss, and espeak.
Home-page: https://github.com/nateshmbhat/pyttsx3
Author: Natesh M Bhat
Author-email: [email protected]
License: UNKNOWN
Location: c:\users\codi-\anaconda3\lib\site-packages
Requires: comtypes, pypiwin32, pywin32
Required-by:
Metadata-Version: 2.1
Installer: pip
Classifiers:
  Intended Audience :: End Users/Desktop
  Intended Audience :: Developers
  Intended Audience :: Information Technology
  Intended Audience :: System Administrators
  Operating System :: MacOS :: MacOS X
  Operating System :: Microsoft :: Windows
  Operating System :: POSIX
  License :: OSI Approved :: GNU General Public License v3 (GPLv3)
  Programming Language :: Python :: 3
  Programming Language :: Python :: 3.5
  Programming Language :: Python :: 3.6
  Programming Language :: Python :: 3.7
Entry-points:
Project-URLs:

am i doing something wrong? no matter how many tutorials or guides i follow none have fixed it

CodePudding user response:

the pyttsx3 library can be used via the anaconda enviroment

CodePudding user response:

There are multiple issues that can cause such behaviour.

First of all, consider using virtual environments or Anaconda for your Python projects.
It will solve lots of basic issues for you, and more of that, Anaconda have conda packages repository.
Not only it is very easy to use, but it will provide you with some packages that are not available at PyPi.
For example, conda will install numpy package built with MKL, that is ~6x more performant, than the version from PyPi.

But if you want to figure out why your specific issue is happening, then I can come up with a bunch of reasons why this can happen.
Sometimes it can be that your pip does not installed the package at the same location where your python is located.
You can easily check this by running pip show pyttsx3 (or with another package), then check the Location:.
Now, run python -m pip show pyttsx3 and check the Location: again.
If they are not equal, then your pip command is associated with some other python directory.

Alternatively you can just install the package through python command like this python -m pip install pyttsx3 in order to make sure, that the package will be installed using current python executable.

Also, sometimes it's about permissions.
If you are using Linux and installed the package with root permissions, then other users will not be able to access it.
Then you may want to remove it with root permissions and install with the permissions you want (i.e. user perms).

  • Related