0

Im trying to get pyttsx3 working for a bit of text to speech code but i keep running into this error:

ModuleNotFoundError: No module named 'Foundation'

Ive tried installing Foundation but nothing seems to work it always returns the same error, currently im using the code from the documentation of pyttsx3 to experiment with this a bit:

import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()

Does anyone know how to get arround this error?

user112918
  • 37
  • 5

2 Answers2

2

Install pyobjc =>https://pythonhosted.org/pyobjc/install.html

pip install -U pyobjc
Isuru Dilshan
  • 719
  • 9
  • 18
0

See similar question here for more detail:

link

Since you are claiming pyobjc is in fact installed, than the issue is probably that python doesn't know where to find it.

Find out where it's installed to and add it to your python path from terminal:

export PYTHONPATH="/path/to/PyObjC/"
Derek Eden
  • 4,403
  • 3
  • 18
  • 31
  • PyObjc is in the current python directory : Requirement already satisfied: pyobjc-framework-CFNetwork==6.2 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from PyObjc) (6.2) – user112918 Mar 26 '20 at 21:02