1

I currently begin to use Python (2.7) with Eclipse(on windows). To run my script,I would need PyQt4 but I meet some problems when I try to install it.

I downloaded

  • PyQt4-4.10.3-gpl-Py2.7-Qt4.8.5-x64.exe,
  • PyQt-win-gpl-4.10.3.zip
  • and sip-4.15.2.zip

from the following link: http://www.riverbankcomputing.co.uk/software/pyqt/download .

I launched the execution of the first feature and a folder PyQt4 appeared into C:\Python27\Lib\site-packages.

To my mind, PyQt4 installation was finished and I simply did:

Eclipse>Preferences>Pydev>Interpreter-Python>python27>Apply

Nevertheless, when I try to import any function of PyQt4, I am said that the module name is unknown.

Could you help me to solve this problem?

Thank you very much

Paco
  • 4,520
  • 3
  • 29
  • 53
user2879969
  • 51
  • 1
  • 7
  • 2
    Restart eclipse. Actually first make sure that PyQT is installed, try it on the same version python interperer that is configured for eclipse –  Oct 14 '13 at 18:42
  • When I write "import PyQt4" in my python comand line, I have no Error message and help("PyQt4") also works. Does it validate the fact that PyQt is installed? (I am sorry I am really just beggining with programmation an related features). But the problem is not solved in eclipse after eclipse restart. – user2879969 Oct 14 '13 at 19:32
  • 1
    Yes, PyQT4 is validated. Just make sure that it is same python interpreter, other than you can try reinstalling using this binary http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyqt . Or download the pyqt4 zip archive and install directly into the interpreter. –  Oct 14 '13 at 19:35
  • I appllied your first solution but when launching the executive file, I am said that the installer integrity check has failed. I also tried to paste PyQt-win-gpl-4.10.3 into Python 27 (at different levels (directly in the python27 file or deeper in python27>lib>site-packages>PyQt4) ) but it is always unsuccessful – user2879969 Oct 14 '13 at 20:42
  • When I place the folder PyQt4 of python27>lib>site_packages in anaconda library, I obtain a new error message:"no module named sip" (instead of "no module named PyQt4") ... Can it be considered as an improvement? xD – user2879969 Oct 14 '13 at 21:06
  • Thanks for the tip with restarting eclipse. I was puzzled why it wasn't working beforehand and a restart fixed it!! – Patrick Wolf Jun 01 '14 at 21:53

1 Answers1

0

I want to comment for this .... but my reputation doesn't allow me to :( anyway You could try this answer ..... (link below)

which is something like that :

Copy from This Answer

PyQt is actually a wrapping of C++ Qt libraries. So they are not .py files an d PyDev can't analyze them to get what is in them. You need to add PyQt4 in the Forced Builtins tab, so that PyDev can use a Python shell to "look into" those libraries and know what is in them. That will also give you code-completion for PyQt.

Apart from that, it is usually not a good practice to use from foo import *. You'll be importing everything inside your namespace and you wouldn't know which is coming from where. Moreover you might have name clashes that mask each other. Though it is unlikely with PyQt, still I'd suggest you get used to from PyQt4 import QtGui, QtCore and reference classes like QtGui.QMainWindow.

Community
  • 1
  • 1
Ayyoub
  • 4,581
  • 2
  • 19
  • 32