taoCMS是基于php+sqlite/mysql的国内最小(100Kb左右)的功能完善的CMS管理系统

在Mac OS上安装 Eric4

2012-07-07

网上找的安装教程,新版本的QScintilla-gpl-2.6.2的Qt4Qt5替换本文中的Qt4文件夹,其他类似。

As I lately played a little bit with Python on Mac OS X 10.6 Snow Leopard I was looking for a decent IDE.

Unfortunately there are hardly native ones, not to say none. I tried Eclipse with PyDev (which is inbetween also part of Aptana), which works well, but since its an Java app, it’s somewhat sluggish and its look and feel slightly strange in an OS X environment. What I liked better, was Komodo IDE. Based on Mozillas XML Gui (Xul), it integrates at least somewhat better and proved itself as very responsive. However, its propriatery, not free and $295 would be a high price for my occassional use case. The free and now open source Komodo Edit would be an option, but it lacks some features, like an integrated debugger.

So I finally tried to get Eric4 working on  OS X. Its written in Python itself and uses PyQt4, a Python binding for the Qt4 crossplattform-gui-toolkit,  for its GUI. Unfortunately there are no One-Click-and-install builds for the Mac plattform available, so you have to build it yourself from source including all its dependencies. Ok, no problem you think, since there are some install guides available in the net (e.g.here and here), but all of them are missing some pieces or don’t work with current versions. So lets see,  how I did.
(Updated for Snow Leopard, 2010/01/26)

Update2: for an updated and 64bit centred HowTo look here .

1. Python:

Python comes bundled with every OS X install. In 10.6 python version 2.6.1 is installed. So it’s already there.

2. Install Qt4:

Download it from here: http://qt.nokia.com/downloads/mac-os-cpp and install as usual. Btw, I took the binary packages using Cocoa (32-bit and 64-bit). At the time of install it was Qt 4.6.1.

3. Install SIP:

First look at http://www.riverbankcomputing.co.uk/software/sip/download which version is the most current. Mine was 4.10. Open Terminal.app and type:

ftp http://www.riverbankcomputing.co.uk/static/Downloads/sip4/sip-4.10.tar.gz
tar -xvzpf sip-4.10.tar.gz
cd sip-4.10
python configure.py
make
sudo make install
cd ..

4.Install PyQT:

Now from http://www.riverbankcomputing.co.uk/software/pyqt/download get the current version of PyQt (Mac OS Source). And again in Terminal:

ftp http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-mac-gpl-4.7.tar.gz
tar -xvzpf PyQt-mac-gpl-4.7.tar.gz
cd PyQt-mac-gpl-4.7
python configure.py (have to accept licenses by typing 'yes')
make
sudo make install
cd ..

5. Install QScintilla:

For the QScintilla downloadlink look here:http://www.riverbankcomputing.co.uk/software/qscintilla/download.

ftp http://www.riverbankcomputing.co.uk/static/Downloads/QScintilla2/QScintilla-gpl-2.4.2.tar.gz
tar -xvzpf QScintilla-gpl-2.4.2.tar.gz
cd QScintilla-gpl-2.4.2
cd Qt4
qmake qscintilla.pro -spec macx-g++
make
sudo make install

Now make the Qsci module:

cd ../python
python configure.py
make
sudo make install

6. Now install Eric4:

Download a snapshot and and your localisation from from http://sourceforge.net/projects/eric-ide/files/. ‘cd’ to the regarding folder and:

tar -xvzpf eric4-4.4.0.tar.gz
tar -xvzpf eric4-i18n-de-4.4.0.zip
cd eric4-4.4.0
sudo python install.py
sudo python install-i18n.py

So, ready :-)

But where is it and how to start?
Eric4 was installed into

/Library/Python/2.6/site-packages/eric4

and you can start it with

eric4

in Terminal.

Obligatory screenshot:

Eric4 at Mac Os X Leopard

Eric4 at Mac Os X Snow Leopard

7. Standalone App

If you find it unpleasant and inconvenient to open Eric every time via Terminal.app and have to have this one open all the time too, its time to build a standalone app. The way to do this is with py2app.

There are some ressources around about deploying Python and PyQt applications on Mac OS X, e.g.herehere, and here, and if you read them, you maybe will see, that it isn’t without hitches. You have to install a prefixed python from macports or python.org besides the system one and such, and things become overcomplicated and follow an unclean approach.

There has to be a way, to use the systems Python, even if it means just to link against it and loose portability over different incarnations of Mac OS X.

I have to admit that I failed at this task so far. As someone new to Python I just have to find my way around. However, what I tried, is … placing a “setup.py” into the installation directory of Eric4 ( /Library/Python/2.6/site-packages/eric4 ), cd -ing to the dir and did a “sudo python setup.py py2app” … just to get an error in …. egg/modulegraph/modulegraph.py and a empty build directory. Tried other things like placing the file in the site-packages dir or the source directory of eric4, targeting different files within setup.py, modified the options within what to include and so on, or tried it with the Alias argument (-A). Searching the net for usefull hints, tips and howto’s.

This is the setup.py I started with:

"""
This is a setup.py script generated by py2applet

Usage:
   python setup.py py2app
"""

from setuptools import setup

APP = ['eric4.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True,
'semi_standalone':'False',
'includes': 'Qt4,sip,PyQt4,QScintilla2',
'packages':('Qt4','sip','PyQt4','QScintilla2'),
'site_packages': 'True'}

setup(
   app=APP,
   data_files=DATA_FILES,
   options={'py2app': OPTIONS},
   setup_requires=['py2app'],
)

If you, dear reader, found a way around this last point of making Eric4 feeling at home at OS X please let me now.

[Update 2010/08/09]: Another approach is to use PyInstaller. It seems to still have it quirks on Mac OS X, but there are some workarounds. I haven’t tested it myself, since I’m using Eric4 in a virtual machine with Arch Linux as guest in between, but this site describes exactly all the necessary steps to build a standalone app of Eric4 with PyInstaller.

类别:技术文章 | 阅读:273761 | 评论:0 | 标签:eric mac

想收藏或者和大家分享这篇好文章→

“在Mac OS上安装 Eric4”共有0条留言

发表评论

姓名:

邮箱:

网址:

验证码:

公告

taoCMS发布taoCMS 3.0.2(最后更新21年03月15日),请大家速速升级,欢迎大家试用和提出您宝贵的意见建议。

捐助与联系

☟请使用新浪微博联系我☟

☟在github上follow我☟

标签云