No module named 'PyQt5.QtTextToSpeech'

54 Views Asked by At
Jetson Nano
Ubuntu18.04
Python 3.6.9
PyQt5 Version: 5.10.1+dfsg-1ubuntu2

PyQt5 installed, use apt install xxx

I tried to excute

from PyQt5.QtTextToSpeech import QTextToSpeech

I got an error:

Python 3.6.9 (default, Mar 10 2023, 16:46:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt5.QtTextToSpeech import QTextToSpeech
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5.QtTextToSpeech'

I tried to install

sudo apt install python3-pyqt5

but nothing changed. How can I install the module for my machine.

1

There are 1 best solutions below

3
Jeevan ebi On BEST ANSWER

You can try installing the required PyQt5 modules using pip instead.

  • Ensure that pip is installed. You can install it using apt if it's not already installed:

    sudo apt update
    sudo apt install python3-pip
    
  • Then, install PyQt5 using pip:

    sudo pip3 install pyqt5
    

This will install PyQt5 along with all its components, including QtTextToSpeech. After installing PyQt5 with pip, try importing QTextToSpeech again in your Python script:

from PyQt5.QtTextToSpeech import QTextToSpeech