pythonpipspeech-to-textwatson

Getting Pip to install in specific Python versions for IBM Watson use


I have two versions of Python in my /usr/bin directory. Python2.7 and Python3.6. Entering "Python --version" in a terminal I get "Python 2.7.15" back. I'd like to add watson_developer_cloud to 2.7. However when I enter

pip install watson_developer_cloud

watson_developer_cloud shows up in /usr/lib/Python3.6 and not /usr/lib/Python2.7.

Question: How do I get watson_developer_cloud in Python2.7?

I am trying to get Watson speech-to-text configured to use sttClient.py. Thanks in advance.


Solution

  • You can tell pip which version of python you wish to use:

    #Install x library using python 2.7
    $ python-2,7 -m pip install x
    

    It seems that is is the best recommendation since it supports all versions of Python, and in all forms of virtualenv. You can read more about this here: pip: dealing with multiple Python versions?