PyCharm's autocomplete isn't working for installed libraries. I have the following code:
PyCharm的自动完成功能不适用于已安装的库。我有以下代码:
from boto.emr.connection import EmrConnection
conn = EmrConnection(aws_keys.access_key_id, aws_keys.secret_key)
I want the editor to tell me what methods I have available to me when I press ctrlspace.
我希望编辑告诉我当我按ctrlspace时我可以使用哪些方法。
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?
boto库安装在我的环境中,但PyCharm似乎没有检测到它。如何正确设置?
1 个解决方案
#1
38
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中,但PyCharm默认情况下不知道这一点。如果没有指定任何内容,它将选择系统Python安装作为解释器。您需要进入项目设置并配置解释器以指向virtualenv。然后PyCharm将为解释器编制索引并允许您自动完成。
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).
可以在左侧的下拉菜单中自动检测virtualenv。如果不是,请单击右侧的齿轮,单击“添加本地”,然后选择/ path / to / virtualenv / bin / python(或Windows上的\ Path \ to \ virtualenv \ Scripts \ python.exe)。
#1
38
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中,但PyCharm默认情况下不知道这一点。如果没有指定任何内容,它将选择系统Python安装作为解释器。您需要进入项目设置并配置解释器以指向virtualenv。然后PyCharm将为解释器编制索引并允许您自动完成。
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).
可以在左侧的下拉菜单中自动检测virtualenv。如果不是,请单击右侧的齿轮,单击“添加本地”,然后选择/ path / to / virtualenv / bin / python(或Windows上的\ Path \ to \ virtualenv \ Scripts \ python.exe)。