首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Python不导入GETCH

Python不导入GETCH
EN

Stack Overflow用户
提问于 2016-11-09 19:44:10
回答 1查看 5.4K关注 0票数 0

我已经安装了(通过PIP/终端) GETCH,但是python在我告诉它时不会识别它。

代码语言:javascript
复制
import getch

我在苹果电脑上

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-11-10 01:16:02

您标记了这个问题3.x,但getch安装的证据清楚地表明它已安装在site-packages中,为2.7。您还为pip提供了一个指向Python2tarball的显式路径。

为Python的一个版本安装包并不会安装其他版本的包。运行pip3来安装Python3的软件包(根据安装程序的不同,它可能被命名为pip-3.5等)。如果没有安装pip3python3 -mensurepip应该添加它(取决于Python次要版本),否则您必须手动安装它。无论哪种方式,一旦您拥有了pip3,您只需要正确地安装该软件包:

代码语言:javascript
复制
sudo pip3 install getch
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40514769

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档