简体   繁体   English

PyCharm自动完成

[英]PyCharm autocomplete

I'm completely new to Python and PyCharm and I cannot figure out why PyCharm doesn't auto-completes very simple cases such as: 我是Python和PyCharm的新手,我无法弄清楚为什么PyCharm无法自动完成非常简单的情况,例如:

import pickle

pickle.dum[control+space or control+shift+space results nothing here]

I have PyCharm 2.6.2 and Python 2.7.1. 我有PyCharm 2.6.2和Python 2.7.1。 What's wrong? 怎么了?

Add: 加:

I'm on Mac OS 10.7.3 我在Mac OS 10.7.3上

Can't reproduce. 无法复制。 Make sure you have a valid Python interpreter configured for the project. 确保为项目配置了有效的Python解释器。 Also try File | 也尝试File | Invalidate Caches . Invalidate Caches

泡菜

My experience is if you turn ON the File -> Power-Save Mode, all background tasks will be stopped, including the Auto-Complete task. 我的经验是,如果打开“文件”->“省电模式”,则所有后台任务都将停止,包括“自动完成”任务。 So you can try turning off the Power-Save Mode. 因此,您可以尝试关闭省电模式。

You could try with a virtualenv and on it install all you project dependencies and the go to pycharm preferences/Project Interpreter and it will update your project dependencies. 您可以尝试使用virtualenv并在其上安装所有项目依赖项,然后转到pycharm首选项/项目解释器,它将更新您的项目依赖项。

Project Inspector 项目检查员

我更改了投影机解释器,现在可以正常工作了。

It happened to me, too. 这件事也发生在我身上。 But all the previous answers don't solve my issue. 但是以前所有的答案都不能解决我的问题。

The weird thing is when I am coding, it will pump out the autocomplete for me. 奇怪的是,当我编码时,它将为我自动输出自动完成功能。 But once I leave the autocomplete mode, I cannot reproduce the autocomplete by typing Ctrl + Space . 但是一旦退出自动完成模式,就无法通过Ctrl + Space来重现自动完成。

So the work I already surveyed are 所以我已经调查过的工作是

  1. Make sure the config(eg, virtualenv) is right in Pycharm 确保配置(例如,virtualenv)在Pycharm中正确
  2. Make sure Pycharm can show autocomplete 确保Pycharm可以显示自动完成
  3. Make sure I am not in the Power Safe Mode 确保我不在Power Safe Mode

Finally I solved this just because my shortcut of switch language in the Mac is also Ctrl + Space , so it's kind of override my shortcut in the Pycharm. 最后,我解决了这个问题,只是因为在Mac中切换语言的快捷方式也是Ctrl + Space ,所以它有点像在Pycharm中覆盖了我的快捷方式。 I change the shortcut in the Pycharm by changing in Pycharm-> Preference-> Keymap-> Main menu-> Code-> Completion ->Basic 我通过更改Pycharm-> Preference-> Keymap-> Main menu-> Code-> Completion ->Basic来更改Pycharm-> Preference-> Keymap-> Main menu-> Code-> Completion ->Basic的快捷方式

Then the problem is solved 然后问题解决了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM