PyCharm 中的 PyQt4 没有自动完成功能 [英] No autocomplete for PyQt4 in PyCharm

查看:51
本文介绍了PyCharm 中的 PyQt4 没有自动完成功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的办公室电脑上使用

On my office PC I'm using

  • Python 3.4
  • PyQt4 版本 4.11.1
  • PyCharm 社区版 3.4.1

我按照上述顺序安装了所有东西.

I installed everything in the order as stated above.

但是,代码补全不起作用.它适用于导入,但不适用于类和方法.

However, code completion does not work. It works for imports, but not for classes and methods.

我做了一个小示例程序:

I made a small sample program:

import sys
from PyQt4 import QtGui


app = QtGui.QApplication(sys.argv)

window = QtGui.QWidget()

window.setWindowTitle("Test")
window.resize(300, 200)
window.show()

sys.exit(app.exec_())

在上面的代码中,PyCharm 没有推荐任何类或方法.

In the code above none of the classes or methods were suggested by PyCharm.

如果我输入 window.setW 我希望它建议 setWindowTitle() 但它没有.

If I type window.setW I would expect it to suggest setWindowTitle() but it doesn't.

奇怪的是,我在家里的电脑上使用相同的设置,在那里它就像一个 (Py) 魅力......自动完成、自动导入等.据我所知,我安装的也是一样的就像我在办公室电脑上所做的那样.

Strange thing is, that I'm using the same setup on my computer at home and there it works like a (Py)charm... Autocompletion, auto imports, etc. As far as I remember I installed it the same way as I did on my office PC.

我已经看过一些类似的问题,但是这个问题没有答案,其他问题也不包含迄今为止对我有帮助的相关信息.

I already looked at some similiar questions but this question has no answers and others don't contain relevant information that helped me so far.

不知道是否相关,但在这一行

Don't know if it is relevant but at this line

from PyQt4 import QtGui

PyCharm 告诉我

PyCharm tells me

未解析的引用'QtGui'

Unresolved reference 'QtGui'

也许原因是一样的.

推荐答案

先安装PyCharm,再安装Python和PyQt解决了问题.

The problem was solved by installing PyCharm first and then Python and PyQt.

之后我不得不在 PyCharm 中配置解释器并且它工作了.

Afterwards I had to configure the interpreter in PyCharm and it worked.

当我发布问题时,我安装了 Python,然后是 PyQt,然后是 PyCharm.

When I posted the question I installed Python, then PyQt and then PyCharm.

奇怪的是,它在另一台 PC 上按此顺序运行.

Oddly enough, it worked in this order on another PC.

这篇关于PyCharm 中的 PyQt4 没有自动完成功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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