Search code examples
pythonpyqtinstallationpython-wheel

Why I can't import Pyqt in python after install it?


I am very noob in Python and now I have a hard time to install PyQt and PyQwt.

I searched how to do for many site but I still can't get out of this problem. Now I decide to follow Christoph Gohlke's. I'm success to use pip to install numpy wheel file and can import it in python but it is not for PyQt and PyQwt.

For PyQt, when I install the wheel file through cmd with this

pip install PyQt4-4.11.4-cp27-none-win_amd64.whl

it appear

Requirement already satisfied (use --upgrade to upgrade): PyQt4==4.11.4 from file:///C:/Users/Mann/Downloads/PyQt4-4.11.4-cp27-none-win_amd64.whl in c:\python27\lib\site-packages

I think the installation probably success, so I try to import PyQt4 in Python2.7

import PyQt4

but it fail and appear an error

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import PyQt4
ImportError: No module named PyQt4

I also call pip.exe in "Script" directory as https://stackoverflow.com/a/27909082/5041101 said but it still the same. Please help me get out of this.

Thank you


Solution

  • Did you try forcing re-installation?

    pip install --force-reinstall PyQt4-4.11.4-cp27-none-win_amd64.whl
    

    or

    pip install --upgrade --no-deps --force-reinstall PyQt4-4.11.4-cp27-none-win_amd64.whl