gpt4 book ai didi

python - 如何让 PyQt4 与 PyCharm 一起工作

转载 作者:太空狗 更新时间:2023-10-30 00:13:58 26 4
gpt4 key购买 nike

所以我试图让一个程序使用 PyQt4 在我的 Mac 上的 PyCharm 中工作,但每当它试图运行时,它都会说

INFO: Could not import backend "PyQt4":

No module named PyQt4

尝试使用 PyCharm 的包管理器导入 PyQt4 会生成此错误:

Executed Command:

pip install PyQt4

发生错误:

0:428: execution error: The directory '/Users/pkillam/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

建议的解决方案:

Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at '/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7'.

这只会发生在 pip 不喜欢的某些包上,特别是那些使用 configure.py 而不是 setup.py 的包,如 here 所述。 .

尝试从控制台运行命令会生成此错误:

$ pip install PyQt4

Collecting PyQt4 Could not find a version that satisfies the requirement PyQt4 (from versions: ) No matching distribution found for PyQt4

$

现在,使用 homebrew 安装包声称是成功的,但我仍然得到初始错误,即 PyQt 在 homebrew 安装后无法导入......某处。

在过去的一天里,我一直在绕圈子,有什么想法吗?

最佳答案

您可以尝试通过从 official Website 下载 PyQt4 来安装它。 .请记住下载与您的 python 版本相同的 PyQt 版本。如果您有 python 2.7 32 位,那么即使您的计算机是 64 位,也请下载 PyQt4 32 位。
同样,如果您有 Python 3.x 64 位,则需要下载 PyQt4 64 位。
您可以从默认的 Python“IDLE”检查您的 Python 版本。应该和这个差不多。
Win32 上的 Python 3.4.3(v3.4.3:9b73f1c3e601,2015 年 2 月 24 日,22:43:06)[MSC v.1600 32 位(英特尔)]

关于python - 如何让 PyQt4 与 PyCharm 一起工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31711812/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com