我想为我的Python临时 Logger 创建小的用户界面,强烈建议使用PyQT,但我不能让它在Win7 Ultimate x64,SP1上运行 . 我读了如何提出好问题 - 我知道,Windows ...
我使用从Python.org下载的python-3.4.3.amd64.msi安装了Python 3.4.3 - 它可以工作 .
然后我使用来自riverbankcomputing.com的Windows 64位安装程序安装了PyQT5:PyQt5-5.5.1-gpl-Py3.4-Qt5.5.1-x64.exe
我认为这是我需要做的就是能够在Python中导入PyQT5 . 但是,python没有看到PyQT5 . 从python提示符我输入:
>>> import sys
>>> import PyQT5
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import PyQT5
ImportError: No module named 'PyQT5'
我研究了错误,但大多数答案都是从二进制文件和Linux环境构建PyQT5 . 一些答案建议将PyQT5添加到路径中 . 我尝试将各种目录添加到Python路径,但没有看到任何改进 .
我的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
我的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']
我卸载了所有内容并重新安装了python 3.4.0,以防后续维护版本中出现导致不兼容的问题 . 同样的问题 . 我再次卸载并重新安装了32位版本,同样的问题 . 我在另一台Win7x64机器上安装了一切,同样的问题 .
我究竟做错了什么? (除了使用Windows?)
我从来没有用二进制文件构建任何东西,但我试着遵循指示 . 但SIP官方指示不包括下载QT . 这里的一些答案说你必须在运行SIP配置之前这样做...
1 回答
尝试
import PyQt5
而不是PyQT5
. 如果失败,请尝试from PyQt5 import *
&from PyQT5 import *
. 谢谢!