I tried below code:
>>> import pyttsx3
>>> engine = pyttsx3.init()
>>> engine.say('hello')
>>> engine.runAndWait()
But it give me an error as below:
import pywintypes
ModuleNotFoundError: No module named 'pywintypes'
I already tried this to solve:
pip install pypiwin32
python -m pip install pywin32
pip install -U pypiwin32
python -m pip install pyttsx3==2.71
But not any one work for me.
I'm using win10
can anyone help me?
If you want to use pyttsx3 in python 3 you have to use pip3 not pip to install the packages. It won't work with pip. pip works for python2 only.
Try the following:
pip3 install pywin32 pypiwin32 pyttsx3
This should work
Related
I want to install a module with pip, in my case pydub.
However pip install pydub installs pydub in /home/<user>/.local/lib/python2.7/
So when I run my script
python3 myScript.py
it tells me
ModuleNotFoundError: No module named 'pydub'
How do I get pip to install pydub for 3.x rather than 2.7?
Use pip3 install xxx, or better yet, python3 -m pip install xxx. The problem here is that by default pip is aliased to python2's installation.
I have installed xmltodict successfully using the below command
python -m pip install --upgrade --user xmltodict
But when I am executing a python script which contains import xmltodict I am getting the below error
import xmltodict
ModuleNotFoundError: No module named 'xmltodict'
Can some please help me to fix this?
I encountered the same problem in pip 18.1. try to upgrade the pip first, uninstall and reinstall the xmltodict module.
I have the kivy version 1.10.0 and python version 3.6.1. When I am running the very first example from https://media.readthedocs.org/pdf/kivy/latest/kivy.pdf I am getting an error.
Here is my code
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text='Hello world')
if __name__ == '__main__':
MyApp().run()$
This is the error that i am getting.
[CRITICAL] [App ] Unable to get a Window, abort.
An exception has occurred, use %tb to see the full traceback.
SystemExit: 1
I just had the same issue. I was able to fix it by running the following commands:
py -m pip install --upgrade pip wheel setuptools
py -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew
py -m pip install kivy.deps.gstreamer
good luck!
It seems like a dependencies problem. Install these dependencies in the project folder and you will probably be fine (I am assuming that you're using W10).
python -m pip install docutils pygments pypiwin32 kivy_deps.sdl2==0.1.22 kivy_deps.glew==0.1.12
python -m pip install kivy_deps.gstreamer==0.1.17
I installed the python package Pillow to my virtualenv, but cannot import it. pip list | grep Pillow shows that it has been installed, and the virtualenv has been activated, but import Pillow still returns:
ImportError: No module named 'Pillow'
The virtualenv was created with
virtualenv -p python3.5 MainEnv
Pillow was installed with
pip install Pillow
Why can I not import the installed package?
I believe you pip install as Pillow, but import as PIL:
http://www.pythonforbeginners.com/gui/how-to-use-pillow
I try to use RPi.GPIO with Python 3.6.
I installed RPi.GPIO and it's working with Python 3.4, but not with Python 3.6
I get this Error:
ModuleNotFoundError: No module named 'RPi'
I immport the module in my script like this:
import RPi.GPIO as GPIO
Add this line to the top of your *.py file:
#!/usr/bin/env python3.6
Run these commands in your shell:
sudo python3.6 -m pip install --upgrade pip setuptools wheel
sudo python3.6 -m pip install RPi.GPIO
This should fix the Problem.
By this you will install RPi.GPIO for the right python version. In this case 3.6.x.