简体   繁体   English

导入错误:没有名为 PyQT5 的模块 (Win7x64)

[英]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.我想为我的 Python 临时记录器创建小型用户界面,强烈推荐 PyQT,但我无法让它在 Win7 Ultimate x64 SP1 上运行。 I read how to ask good questions - I know, Windows...我阅读了如何提出好问题 - 我知道,Windows ...

I installed Python 3.4.3 using the python-3.4.3.amd64.msi, downloaded from Python.org - it works.我使用从 Python.org 下载的 python-3.4.3.amd64.msi 安装了 Python 3.4.3 - 它有效。

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然后我使用来自 riverbankcomputing.com 的 Windows 64 位安装程序安装了 PyQT5: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.我认为这就是能够在 Python 中导入 PyQT5 所需要做的全部工作。 However, python does not see PyQT5.但是,python 没有看到 PyQT5。 From the python prompt I type:在 python 提示符下,我输入:

>>> 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.我研究了这个错误,但大部分答案都是针对从二进制文件和 Linux 环境构建 PyQT5 的。 Some answers suggest adding PyQT5 to the path.一些答案建议将 PyQT5 添加到路径中。 I tried adding various directories to Python path, but did not see any improvement.我尝试将各种目录添加到 Python 路径,但没有看到任何改进。

My windows system path is:我的windows系统路径是:

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 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:我的 python sys.path 是:

>>> 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.我卸载了所有内容并重新安装了python 3.4.0,以防以后维护版本中的某些内容导致不兼容。 Same problem.同样的问题。 I uninstalled again and re-installed the 32 bit versions, same problem.我再次卸载并重新安装了 32 位版本,同样的问题。 I installed everything on another Win7x64 machine, same problem.我在另一台 Win7x64 机器上安装了所有东西,同样的问题。

What am I doing wrong?我究竟做错了什么? (besides using Windows?) (除了使用 Windows?)

I never built anything from binaries, but I tried following the directions.我从来没有从二进制文件中构建过任何东西,但我尝试按照说明进行操作。 But the official SIP directions do not include downloading QT.但是官方的 SIP 说明不包括下载 QT。 some answers here say you do have to do that before running SIP configure...这里的一些答案说你必须在运行 SIP 配置之前这样做......

Try import PyQt5 rather than PyQT5 .尝试import PyQt5而不是PyQT5 If that fails as well, try from PyQt5 import * & from PyQT5 import * .如果这也失败了,请尝试from PyQt5 import * & from PyQT5 import * Thanks!谢谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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