Getting syntax error while running the following command on terminal:
pip install gTTS File "", line 1 pip install gTTS ^
Getting syntax error while running the following command on terminal:
pip install gTTS File "", line 1 pip install gTTS ^
That's not how you run pip... You run it from the system shell like this
> pip install gTTS
or
> python -m pip install gTTS
If you want to run it from inside a script, or a python shell you do it like this
import pip
def install(package):
pip.main(['install', package])
# Example
if __name__ == '__main__':
install('gTTS')
If you had installed Anaconda IDE, the installation gets much hassle-free as it eliminates the headaches of trying to figure out which version/release of package X is compatible with which version/release of package Y.
Just open the Conda prompt shell and type the following command and hit Enter
:
pip install gTTS
Voila! The package will be successfully installed in a jiffy!
I mentioned in my reply to sehafoc I tried running the command from shell and started getting another error "no module name pip", so I installed pip by running following commands:
Downloaded pip script $ curl https://bootstrap.pypa.io/get-pip.py > get-pip.py
Executed the pip script by running following command $ sudo python get-pip.py
Install gTTS module $ sudo pip install gTTS
If you can't use your pip on your cmd. But first thing, you have to install your pip with syntax:
python -m install pip
And don't forget to add python to your path, and then type this syntax to your cmd
python -m pip install gtts
and your gtts will dowloaded automatically