为什么 PyCharm 的自动完成功能不适用于我安装的库? [英] Why isn't PyCharm's autocomplete working for libraries I install?

查看:46
本文介绍了为什么 PyCharm 的自动完成功能不适用于我安装的库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PyCharm 的自动完成功能不适用于已安装的库.我有以下代码:

PyCharm's autocomplete isn't working for installed libraries. I have the following code:

from boto.emr.connection import EmrConnection
conn = EmrConnection(aws_keys.access_key_id, aws_keys.secret_key)

我希望编辑器在我按下 ctrlspace 时告诉我我可以使用哪些方法.

I want the editor to tell me what methods I have available to me when I press ctrlspace.

boto 库安装在我的环境中,但是 PyCharm 似乎没有检测到它.如何正确设置?

The boto library is installed in my environment, but it doesn't seem to be detected by PyCharm. How can I set this up correctly?

推荐答案

您已将第 3 方库安装到 virtualenv 中,但默认情况下 PyCharm 并不知道这一点.如果未指定任何内容,它将选择系统 Python 安装作为解释器.您需要进入项目设置并将解释器配置为指向 virtualenv.PyCharm 然后将索引解释器并允许您自动完成.

You've installed the 3rd-party library into a virtualenv, but PyCharm doesn't know about that by default. If nothing is specified, it will choose the system Python install as the interpreter. You need to go into the project settings and configure the interpreter to point at the virtualenv. PyCharm will then index the interpreter and allow you to autocomplete.

可以在左侧的下拉菜单中自动检测 virtualenv.如果不是,点击右边的齿轮,点击添加本地",然后选择/path/to/virtualenv/bin/python(或\Path\to\virtualenv\Scripts\python.exe 在 Windows 上).

The virtualenv may be auto-detected in the dropdown menu on the left. If it is not, click the gear to the right, click "Add local", and select /path/to/virtualenv/bin/python (or \Path\to\virtualenv\Scripts\python.exe on Windows).

这篇关于为什么 PyCharm 的自动完成功能不适用于我安装的库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆