Over the past couple of months I've set about using Wing IDE to do the vast majority of my programming. I chose Wing primarily because it works well with wxPython, allowing me to debug much more quickly than was the case when I was using TextWrangler alongside Terminal. A quirk of Wing however is that there is no satisfactory way to force universal builds of python to run in 32-bit mode. Since I'm using wxPython 2.8.x (32-bit only) I'm using a 32-bit-only version of python as the executable (2.7.1). So long as I'm only using the python standard library and wxPython I have no problems, my trouble begins when I start trying to install third-party modules to work with this 32-bit version of Python. I want to do all my installing using macports, but it appears that the macports I have downloaded installs modules for use only with a different version of python that happens to be universal. Essentially then this is a question about macports, and I'd appreciate clarification on the following two points:
Help much appreciated.
A Python installed at /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
almost certainly has nothing to do with MacPorts. You probably installed it from a python.org
installer. If you want to install packages to it, you should install separate versions of easy_install
using the Distribute package and/or pip
for it and directly install packages for that Python instance with them. Those versions will be installed in the framework bin directory, /Library/Frameworks/Python.framework/Versions/2.7/bin.
You can't manage Python packages for it from MacPorts; that works only for MacPorts Pythons, i.e. at /opt/local/bin
.
So it appears you have three versions of Python 2.7 installed. The Apple-supplied system Python at /usr/bin/python2.7
, a MacPorts-installed version at /opt/local/bin/python2.7
, and a third (possibly from python.org) at /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
(for which there is likely a symlink at /usr/local/bin/python2.7
). There's nothing inherently wrong about having all three installed and the three can easily co-exist. Just keep in mind which one you are using, either by managing your shell path or using an absolute path to each, and that any additional packages installed need to be installed to the correct Python's site-packages directory. If you use easy_install
or pip
, you need to install and/or use the correct one for each.
If your goal is just to use wx-python
with Python 2.7, there is an outstanding MacPorts issue about building a 32-bit-only version of wx-python
because of its dependency on deprecated OS X Carbon APIs. There appears to be a new MacPorts port of a Cocoa version of wxWidgets which should work in 64-bit mode. You might want to experiment with it:
sudo port selfupdate
sudo port install py27-wxpython-devel