2

I'm introducing myself to PyQt5 through one of its included examples. On this windows 7 machine, I have installed Python 3.4 x64, and PyQt5 using its binary provided on riverbankcomputiong.com. The documentation says that the binary already includes everything necessary to run. I (perhaps incorrectly) assumed that i can safely skip the "configure" and "build" steps at Riverbank's installation guide, since the guide only talks about .zip, .tar, etc. files.

I used the tutorial located here:

http://www.pythonschool.net/pyqt/introduction-to-pyqt/

Which also says "just run the binary to install pyqt4 there is no step three."

When i attempt to run any tutorial containing reference to PyQt4 or PyQt5:

from PyQt5.QtCore import *

I get the following error message:

ImportError: DLL load failed: The specified module could not be found.

But when i enter the following:

import PyQt5

The interpreter seems to be okay with it -- no errors.

I can't help but think I've done something wrong installation, because even when I run the examples included with PyQt4/PyQt5, i get importerrors. It seems as though QtCore doesn't even exist in relation to PyQt4 or PyQt5. What's going on here?

Jpsousa4
  • 21
  • 1
  • 3
  • It sounds like you might need to update your PATH environment variable to include the location where the library is installed (i.e. directory location where the DLLs are) – code_dredd Sep 11 '15 at 23:35
  • Using windows command prompt and entering: 'echo %PATH%' yeilds lots and lots of paths to various folders. Two of which are two the PyQt5 folder (C:\Python34\Lib\Site-packages\PyQt5), and the Python34 folder (C:\Python34) Are those two correct? – Jpsousa4 Sep 11 '15 at 23:50
  • Seems likely to be ok. Assuming it is, keep in mind PyQt5 is a *binding* to Qt. You must still install the Qt Framework for the bindings to work. If this works, let me know and I'll post it as an answer. – code_dredd Sep 12 '15 at 10:02

1 Answers1

0

There seem to be a few possibilities:

  • You might need to update your PATH environment variable to include the location where the library is installed (i.e. directory location where the DLLs are)

  • Take note of where you're launching the interpreter or scripts from as their current path may not necessarily include what you expect.

You can check this with:

>>> import os
>>> os.environ['PATH'].split(os.pathsep)
  • Make sure the installation process was truly successful (i.e. zero errors) and that you downloaded the correct binary package for your PC's architecture.

I ran into a similar issue with PySide where import PySide would work but import PySide.QtCore would fail.

I'd expect the code to work after verifying those things:

>>> from PyQt5.QtCore import *
>>>

If it doesn't, update the question with additional details like things you checked, their values, error messages, etc.

code_dredd
  • 5,915
  • 1
  • 25
  • 53