在Lion(OSX)上安装PyQt4的问题
我正在尝试在使用Lion系统的Mac上安装Python的开发环境eric4。我已经安装了PyQt-mac-gpl-4.8.6、QT-1.1.4和SIP-4.13。当我进入下载eric4
的文件夹,并运行命令sudo python install.py
时,出现了以下信息:
Checking dependencies
Python Version: 2.7.1
Found PyQt4
Sorry, please install QtHelp.
Error: No module named QtHelp
我该如何安装QtHelp模块呢?我使用QT安装程序时选择了默认选项。当我尝试使用自定义选项重新安装时,找不到任何帮助文件的列表。
补充说明:
回想起来,我意识到这和Eric没有关系,而是我无法安装PyQT4的问题。当我运行以下命令时:
python2.7 configure.py -w -g -q /Users/cel/QtSDK/Desktop/Qt/474/gcc/bin/qmake
我得到了以下输出:
Checking to see if the QtHelp module should be built...
g++ -DQT_NO_DEBUG -I. -I/Users/cel/QtSDK/Desktop/Qt/474/gcc/mkspecs/default -I/Users/cel/QtSDK/Desktop/Qt/474/gcc/lib/QtHelp.framework/Headers -I/Users/cel/QtSDK/Desktop/Qt/474/gcc/include -pipe -O2 -w cfgtest_QtHelp.cpp -o cfgtest_QtHelp -F/Users/cel/QtSDK/Desktop/Qt/474/gcc/lib -L/Users/cel/QtSDK/Desktop/Qt/474/gcc/lib -headerpad_max_install_names -framework QtHelp
Undefined symbols for architecture x86_64:
"QString::fromAscii_helper(char const*, int)", referenced from:
_main in ccPUS9BG.o
"QString::free(QString::Data*)", referenced from:
_main in ccPUS9BG.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
这可能是因为在Lion
上编译这个版本的PyQT4时出现了问题?
2 个回答
我在邮件列表上发现了一些东西,对我来说效果很好:)
我需要在配置脚本里加上一行代码,这样在构建的时候,qthelp模块就能加载qtcore库了。
--- PyQt-x11-gpl-4.9/configure.py~ 2011-12-23 14:53:07.981490550 +0100 +++ PyQt-x11-gpl-4.9/configure.py 2011-12-23 14:52:38.384984221 +0100 @@ -1264,7 +1264,7 @@ opengl = (mname == "QtOpenGL")
qt = [mname]
- 如果模块名是 "QtOpenGL" 或 "QtWebKit": + 如果模块名是 "QtHelp"、"QtOpenGL" 或 "QtWebKit": qt.append("QtCore")
makefile = sipconfig.ProgramMakefile(sipcfg, console=1, qt=qt, warnings=0,
对我来说效果很好。
首先,检查一下你的 QtHelp
模块是否真的安装好了。
在控制台里运行这个命令,看看你的 PyQt4 包在哪里:
python2.7 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
然后在得到的文件夹里找找有没有 PyQt4/QtHelp.*
这样的文件。如果什么都没有,就用 verbose
参数重新运行 PyQt4 的配置:
$ make clean
$ python2.7 configure.py -w
这样做会显示一些错误信息,告诉你为什么 QtHelp
模块的配置失败了。大多数情况下,这可能是因为缺少了一些必要的库或者构建工具。