Aaron oliver Aaron oliver - 25 days ago 23
Python Question

Python not importing GETCH

I have installed (Through PIP/The Terminal) GETCH yet python will not recognize it when I tell it to

import getch


I am on a Mac

sudo pip install https://pypi.python.org/packages/source/g/getch/getch-1.0-python2.tar.gz#md5=586ea0f1f16aa094ff6a30736ba03c50
The directory '/Users/aaronoliver/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/aaronoliver/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting https://pypi.python.org/packages/source/g/getch/getch-1.0-python2.tar.gz#md5=586ea0f1f16aa094ff6a30736ba03c50
Downloading getch-1.0-python2.tar.gz
Requirement already satisfied (use --upgrade to upgrade): getch==1.0 from https://pypi.python.org/packages/source/g/getch/getch-1.0-python2.tar.gz#md5=586ea0f1f16aa094ff6a30736ba03c50 in /Library/Python/2.7/site-packages

Answer

You tagged this question 3.x, but your evidence that getch is installed clearly indicates it's installed in the site-packages for 2.7. You also provided pip an explicit path to a Python 2 tarball.

Installing a package for one version of Python doesn't install it for other versions. Run pip3 to install packages for Python 3 (it may be named pip-3.5 or the like, depending on setup). If pip3 is not installed, python3 -mensurepip should add it (depending on Python minor version), or you'll have to install it manually. Either way, once you have pip3, you just need to install the package correctly:

sudo pip3 install getch
Comments