Reputation: 271
When I run the code in pyCharm it returns, "ModuleNotFoundError: No module named 'Foundation'".
I tried to install pyttsx3 in my terminal it returns "Could not install packages due to an EnvironmentError:" I then tried to install pyobjc but got the same error. Lastly I tried to install and import Foundation but it did nothing.
import pyttsx3
engine = pyttsx3.init()
engine.say("Testing")
engine.runAndWait()
Upvotes: 1
Views: 38021
Reputation: 29
At first try to install it by writing this commandpy -3 -m pip install pyttsx3
in terminal.
Again, if it get installed but shows error, then go to terminal and type sudo apt install libespeak1
(in ubuntu)
Hope your issue will be solved.
Upvotes: 1
Reputation: 1
[Work on Mac]
Pycharm --> Preference --> Project --> Python Interpreter --> click on a "+" symbol (down left corner) --> search "pyttsx3" (or any pip package) --> Install (It will take awhile but works)
Upvotes: 0
Reputation: 1
You can use pyttsx3 by uninstalling the older one and installing the new one or you can go with pywin32 with this command pip install pywin32
Upvotes: 0
Reputation: 1
In my case this problem occurred when I updated my python version. So I simply uninstalled the older version of python and added the new version on path by the following process:
This PC -> Properties -> Advanced System settings -> Environment Variable -> System Variables -> Path -> Edit -> Browse -> Select the Python folder where it is installed.
After that in the terminal update you pip version by the command:
'path' python -m pip install –upgrade pip
In place of path write the file location.
Now simply install pyttsx3 by the command:
pip install pyttsx3
Now your module is ready to be used. To check run a simple program:
import pyttsx3
speaker = pyttsx3.init()
speaker.say('hello there')
speaker.runAndWait()
Upvotes: 0
Reputation: 9
if you are running visual code, then run the file from python terminal when right click on code window option present there
Upvotes: 0
Reputation: 71
Go to your terminal and type pip uninstall pyttsx3
Type pip install pyttsx3==2.71
Then your problem is solved
Upvotes: 6
Reputation: 1
For python versions from and above 2.7:
It took me hours to figure it out, but it works.
Try any possible code on the text-to-speech.
Upvotes: 0
Reputation: 148
If "Requirement already satisfied: pyttsx3 in..." in terminal and module is not found in pycharm then you should install pyttsx3 package in your pycharm. Either create a virtual environment and install the package through pip Or go to pycharm -> setting -> project interpreter, here you'll find the list of packages that has been installed in your pycharm. You can add more packages as per your requirements.
For me it worked.
Upvotes: 1
Reputation:
If your still receiving ModuleNotFoundError after a uninstall and re-install of pyttsx3 then this maybe be the solution for you. In your terminal start by uninstalling pyttsx3
pip uninstall pyttsx3
Then Install pipenv like so
pip install -u pipenv
then
pipenv install pyttsx3
You can find more about pipenv if you like from here.
Here is a stackoverflow answer that proves it works with your problem.
Upvotes: 0