Search code examples
pyqt4pycharm

How do I link PyCharm to PyQt4?


I use PyCharm 2016.2.3 (32-bit), Python 2.7.12 (32-bit), PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x32, Windows 7 Home Premium.

I would be grateful for the procedure to link PyCharm to PyQT4. I'm not a techie.

I linked to the Python interpreter using File > Settings > Project Interpreter, by simply pointing to "python.exe"

For PyQt4, I can see the folder in

C:\Python27\Lib\site-packages\PyQt4

But which file do I actually "point to"?

Thanks.


Solution

  • Here's how I solved this for Python 2.7.12 and Python 3.4.4:

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

    Double-click setup tools

    In Search, type PyQt4

    In left pane, don't select PyQT4. This will give the error

    Could not find a version that satisfies the requirement PyQt4
    

    Instead, select PyQt4_windows_whl. For me, this was successful.

    Test in editor by typing:

    from PyQt4 import QtGui
    

    As soon as I typed

    from P
    

    PyQt4 appeared in the dropdown.

    As soon as I typed

    from PyQt4 import Q
    

    QtGui appeared in the dropdown.

    I'm no expert, so I don't know if these tests are conclusive.