问题描述
我有:
- python 2.7 (anaconda x64),效果很好
- pyqt5(使用 pip install python-qt5 安装)
- pycharm 4.04 professional(最近从 3.4.1 升级)
- 一个小型qt应用程序
- python 2.7 (anaconda x64), which works great
- pyqt5 (installed using pip install python-qt5)
- pycharm 4.04 professional (recently upgraded from 3.4.1)
- a small 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