Installing py2app for Python 2.6.8 (MacPorts) on Mac OS Lion

I needed to install py2app in my main python (2.6.8) which was installed a while ago through MacPorts and has all the useful libraries already in it, PyQt, openCV, numpy, etc.

I tried installing it with the usual :

sudo easy_install -U py2app

but it just installed py2app in the Apple’s Python 2.7 and then skipping my main Python 2.6.8.

I then tried to go to http://pypi.python.org/pypi/setuptools/ to download the egg file for Python 2.6 setuptools-0.6c11-py2.6.egg and then do the

sh setuptools-0.6c11-py2.6.egg

from Terminal but it didn’t work either as it threw the error “…no matching architecture in universal wrapper” as Python 2.6.8 is a 64bit version to be able to work with openCV and the egg was presumably 32 bit.

So, I had to download the source code http://pypi.python.org/pypi/setuptools/ and install it manually, see below for the Terminal commands:

cd Downloads
tar xfz setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
python setup.py build
sudo python setup.py install

at this point to install py2app in the right python (2.6.8), all I needed to do was to choose the right path to the bin to be able to use the newly installed easy_install.

sudo /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/easy_install -U py2app

that’s it. You can try it out by typing python (2.6.8) in the Terminal

import easy_install
import py2app
import py2applet

and it shouldn’t throw any error at this point.

——-

Two additional commands are required to get a python app standalone.

sudo /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/py2applet --make-setup /Users/macbookpro/git/JADE/src/ClientStandAlone.py

this one produced a setup.py file in the home folder (mine was /Users/macbookpro/setup.py), and at last

sudo python /Users/macbookpro/setup.py py2app -A

creates the standalone in the dist folder, always in the home folder.

Advertisements
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: