如何将PyCharm链接到PyQt4?

时间:2016-09-15 18:07:30

标签: pyqt4 pycharm

我使用PyCharm 2016.2.3(32位),Python 2.7.12(32位),PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x32,Windows 7 Home Premium。

我很感激将PyCharm链接到PyQT4的过程。我不是技术人员。

我使用File>链接到Python解释器;设置> Project Interpreter,只需指向" python.exe"

对于PyQt4,我可以在

中看到该文件夹
C:\Python27\Lib\site-packages\PyQt4

但是我实际上是哪个文件"指向"?

感谢。

1 个答案:

答案 0 :(得分:4)

以下是我为Python 2.7.12和Python 3.4.4解决这个问题的方法:

def binary_converter(n):
    if n < 0 or n > 255:
        return "Invalid input"
    tmp = []
    while n:
        n, i = divmod(n, 2)
        tmp.append(str(i))
    return "".join(tmp[::-1] or "0")

双击File > Settings > Project > Project Interpreter > <Python version>

setup tools中,输入Search

在左侧窗格中,请勿选择PyQt4。这将给出错误

PyQT4

而是选择Could not find a version that satisfies the requirement PyQt4 。对我来说,这是成功的。

在编辑器中输入:

进行测试
PyQt4_windows_whl

我输入

from PyQt4 import QtGui

from P 出现在下拉列表中。

我输入

PyQt4

from PyQt4 import Q 出现在下拉列表中。

我不是专家,所以我不知道这些测试是否具有决定性。