Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python PyQt4 OSX错误的体系结构_Python_Macos_Pyqt - Fatal编程技术网

Python PyQt4 OSX错误的体系结构

Python PyQt4 OSX错误的体系结构,python,macos,pyqt,Python,Macos,Pyqt,使用brew安装PyQt后,如下所示: brew install qt brew install sip brew install pyqt 我尝试运行sript,但出现以下错误: Traceback (most recent call last): File "exampleosx.py", line 17, in <module> from PyQt4 import QtGui ImportError: dlopen(/Library/Python/2.7/site

使用brew安装PyQt后,如下所示:

brew install qt
brew install sip
brew install pyqt
我尝试运行sript,但出现以下错误:

Traceback (most recent call last):
  File "exampleosx.py", line 17, in <module>
    from PyQt4 import QtGui
ImportError: dlopen(/Library/Python/2.7/site-packages/PyQt4/QtGui.so, 2): no suitable image found.  Did find:
    /Library/Python/2.7/site-packages/PyQt4/QtGui.so: mach-o, but wrong architecture
回溯(最近一次呼叫最后一次):
文件“exampleosx.py”,第17行,在
从PyQt4导入QtGui
ImportError:dlopen(/Library/Python/2.7/site-packages/PyQt4/QtGui.so,2):未找到合适的映像。确实发现:
/Library/Python/2.7/site-packages/PyQt4/QtGui.so:mach-o,但架构错误
我已经尝试了很多教程,介绍了如何使用不同的选项运行代码,但是没有成功

添加“arch-i368”也不能解决问题


我正在使用OSX 10.7.5和Python 2.7.1

尝试在命令行前面使用$arch-i386运行脚本,类似于:

$arch -i386 python myscript.py

因为Pyqt仅适用于32位体系结构。

请尝试使用此前缀运行脚本

VERSIONER_PYTHON_PREFER_32_BIT=no /usr/bin/python exampleosx.py

也许您还必须执行“python configure.py-d/Library/python/2.7/site-packages-b/usr/local/bin——使用arch=i386”这一博客中解释的操作:我没有从brew安装configure.py,所以我可能应该尝试从其他源安装它,但有一个brew软件包没有按预期安装似乎很奇怪。是的,即使是QT-only也不那么容易安装。PyQT似乎更糟。对不起,我不能再帮你了。祝你好运谢谢你的帮助,不幸的是我解决了这个问题,不知道如何/何时解决。如果我再碰到它,我一定会试试这个。