简体   繁体   中英

Import Error: No module named PyQT5 (Win7x64)

I would like to create small user interface to my Python temp logger and PyQT came highly recommended, but I can't get it to work on Win7 Ultimate x64, SP1. I read how to ask good questions - I know, Windows...

I installed Python 3.4.3 using the python-3.4.3.amd64.msi, downloaded from Python.org - it works.

Then I installed PyQT5 using the Windows 64 bit installer from riverbankcomputing.com: PyQt5-5.5.1-gpl-Py3.4-Qt5.5.1-x64.exe

I think this is all I need to do to be able to import PyQT5 in Python. However, python does not see PyQT5. From the python prompt I type:

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

I researched the error, but most of the answers are for building PyQT5 from the binaries and for the Linux environment. Some answers suggest adding PyQT5 to the path. I tried adding various directories to Python path, but did not see any improvement.

My windows system path is:

C:\\Python34\\Lib\\site-packages\\PyQt5;%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Windows Kits\\8.0\\Windows Performance Toolkit\\;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\;C:\\Program Files\\TortoiseSVN\\bin;C:\\Program Files (x86)\\Common Files\\Rockwell\\;C:\\Program Files (x86)\\Rockwell Automation\\Common\\Components;C:\\Program Files (x86)\\Brackets\\command

My python sys.path is:

>>> sys.path
['', 'C:\\Python34\\Lib\\idlelib', 'C:\\Windows\\system32\\python34.zip', 'C:\\Python34\\DLLs', 'C:\\Python34\\lib', 'C:\\Python34', 'C:\\Python34\\lib\\site-packages', 'C:\\python34\\lib\\site-packages\\PyQT5']

I uninstalled everything and re-installled with python 3.4.0, in case there is something in the later maintenance versions that causes incompatibility. Same problem. I uninstalled again and re-installed the 32 bit versions, same problem. I installed everything on another Win7x64 machine, same problem.

What am I doing wrong? (besides using Windows?)

I never built anything from binaries, but I tried following the directions. But the official SIP directions do not include downloading QT. some answers here say you do have to do that before running SIP configure...

Try import PyQt5 rather than PyQT5 . If that fails as well, try from PyQt5 import * & from PyQT5 import * . Thanks!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM