Python不导入GETCH

时间:2016-11-09 19:44:10

标签: python python-3.x python-import getch

我已安装(通过PIP /终端)GETCH但是当我告诉它时,python将无法识别它

import getch

我在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

1 个答案:

答案 0 :(得分:0)

您标记了此问题3.x,但您明确安装getch的证据表明它已安装在site-packages for 2.7中。您还提供了pip Python 2 tarball的显式路径。

为一个版本的Python安装软件包不会为其他版本安装它。运行pip3以安装Python 3的软件包(可能会命名为pip-3.5或类似软件,具体取决于设置)。如果未安装pip3python3 -mensurepip应添加它(取决于Python次要版本),或者您必须手动安装它。无论哪种方式,一旦你有pip3,你只需要正确安装包:

sudo pip3 install getch