My setup is: 2.6.1 python (apple default, snow leopard), virtualenv, and using virtualenvwrapper
Outside the environment, everything runs in 32-bit which is fine. But with a new project I’m going to work on needs django 1.3 and tons of dependencies, so I made a virtualenv.
I’ve managed to install everything well, except that mysql-python (via pip) gets an error of “mach -o wrong architecture”. I’ve checked my python interpreter with “import sys; sys.maxint” inside the virtualenv and python runs in 64-bit.
I’ve already set systemwide for python to run in 32-bit via “defaults write com.apple.versioner.python Prefer-32-Bit -bool yes”
Does anyone know why this happens inside the virtualenv?
Much of the “magic” that Apple used to implement their
Prefer-32-bitfor the system Pythons in OS X 10.6 is in/usr/bin/pythonwhich then calls the real Python interpreters which are symlinked at/usr/bin/python2.6and/usr/bin/python2.5.virtualenvcopies the real interpreter into the virtualenvbindirectory so thePrefer-32-bitprocessing is bypassed.Among the options to ensure 32-bit operation:
Use the
archcommand to invoke the interpreter.Use
lipoto extract only the 32-bit arch from the universal binary.Install and use a newer 32-bit-only Python 2.6 or 2.7 (installers available from python.org)