需要安装PyQt ,(MacOs自带Python, 需要下载安装Qt 4环境,在Mac 中安装Qt4,推荐使用mpkg安装文件,这个文件需要用右键Open,直接双击打开会被block)。
其次考虑开发环境,普通人都需要开发环境,aren't we? 于是搜了下,看到大家都用Eric, 其主页写着:
Eric is a full featured Python and Ruby editor and IDE, written in python. It is based on the cross platform Qt gui toolkit, integrating the highly flexible Scintilla
editor control.
行了,有这些描述,足够使Eric作为不二之选。
另,如果开发django应用,建议首选aptana,很好用。
Eric有4和5两个版本,Eric5要求Python3.1以上,不过目前主流的Python都是2.x, 因此选4
对应的PyQt4也要求Qt4。
检查Qt4环境,可以使用
$ qmake -v
QMake version 2.01a
Using Qt version 4.8.5 in /Library/Frameworks
安装PyQt4
$ python configure-ng.py -d /Library/Python/2.7/site-packets/ --sip
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/sip
注意-d参数很重要,安装后不用调整环境变量,否则很麻烦。
$ make
编译时总是报 # warning "This version of Mac OS X is unsupported" 估计还没有支持到10.9,于是,修改
/Library/Frameworks/QtCore.framework/Headers/qglobal.h 修改331行为:
# if !defined(MAC_OS_X_VERSION_10_9)
# define MAC_OS_X_VERSION_10_9 MAC_OS_X_VERSION_10_8 + 1
# endif
# if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_9)
# warning "This version of Mac OS X is unsupported"
# endif
不知道有没有问题
$ sudo make install
安装验证:
$ python
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt4
>>> quit()
最后,安装Eric4
$ sudo python install.py
Checking dependencies
Python Version: 2.7.5
Found PyQt4
Found QtHelp
Sorry, please install QScintilla2 and
its PyQt4 wrapper.
Error: cannot import name Qsci
重新在pyQt官方网站下载 QScintilla2安装方法:
cd Qt4Qt5 qmake qscintilla.pro -spec macx-g++ (注意这个参数是mac机用的,其他linux不用) make sudo make install之后binding python
在QScintilla2目录下有个python目录
执行 python configure.py --sip /System/Library/Frameworks/Python.framework/Versions/2.7/bin/sip
make
sudo make install
在进入到
designer-Qt4Qt5 目录
qmake designer.pro -spec macx-g++ (注意这个参数是mac机用的,其他linux不用) make sudo make install
Error: cannot import name Qsci 错误
最后,在eric4安装目录下 sudo python install.py 安装完成。