我有:
pip install python-qt5
安装)Qt
应用程序pip install python-qt5
)Qt
application费尽心思(因为 Riverbank 没有为 Python 2.7 提供 PyQt5 二进制文件,仅适用于3.3+) 多亏了 Marcus Otosson 的 预编译的二进制包,我得到了一切工作.
After much hair-pulling (since Riverbank doesn't provide a PyQt5 binary for Python 2.7, only for 3.3+) I got everything working thanks to Marcus Otosson's pre-compiled binary packages.
Qt 现在已安装并且功能齐全.我的 Qt
应用程序运行良好!
Qt is now installed and fully functional. My Qt
application runs great!
但应用程序尚未完成,并且 PyCharm 不会为 PyQt 模块完成代码完成.它甚至无法识别任何 PyQt5 子模块(如 Qwidgets)的存在:即使它们工作得很好,我仍然会收到红色波浪形 "Unresolved Reference"
警告.
But the application isn't finished yet, and PyCharm won't do code completion for the PyQt modules. It won't even recognize that any PyQt5 sub-modules (like Qwidgets) exist: even though they work just fine, I still get the red squiggly "Unresolved Reference"
warning.
我该如何解决这个问题?我认为这与为二进制 *.pyd
文件生成骨架的固有困难有关.它是如何工作的?我可以手动生成代码骨架,还是从它们正确生成的地方导入它们?
How do I fix this? I assume this has to do with the inherent difficulties in generating skeletons for binary *.pyd
files. How does it work exactly? Can I manually generate code skeletons, or import them from somewhere they generated correctly?
卸载并重新安装 PyCharm 没有帮助.重新配置解释器也没有强制骨架生成器再次运行.
Uninstalling and re-installing PyCharm didn't help. Neither did re-configuring the interpreter to force the skeleton generator to run again.
在我秃顶之前请帮忙.
在 PyCharm 2017.1.1 中遇到了同样的问题.不要这样做
Had the same problem in PyCharm 2017.1.1. Don't do
import PyQt5.QtWidgets
做
from PyQt5 import QtWidgets
这篇关于Pycharm、PyQt5 和 Python 2.7——没有代码完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!