While the problem is fairly easy to overcome if you use the system python, it presents a problem when using virtual environments. For the system Python, simply install the 32-bit Instant Client and tell the system to use the 32-bit python install:
defaults write com.apple.versioner.python Prefer-32-Bit -bool yes
or
export VERSIONER_PYTHON_PREFER_32_BIT=yes
Python in a virtual environment, on the other hand, bypasses the Prefer-32-bit flag and will always run in 64-bit mode. As suggested by Ned Deily on StackOverflow, you can remove the 64-bit binary from the virtual environment python to force it to use 32-bit.
To remove the 64-bit binary, use lipo:
$ which python
/path/to/virtualenv/bin/python
$ file /path/to/virtualenv/bin/python
python: Mach-O universal binary with 2 architectures
python (for architecture x86_64): Mach-O 64-bit executable x86_64
python (for architecture i386): Mach-O executable i386
$ cp /path/to/virtualenv/bin/python /path/to/virtualenv/bin/python-universal
$ lipo /path/to/virtualenv/bin/python-universal -thin i386 -output /path/to/virtualenv/bin/python
$ file /path/to/virtualenv/bin/python
/path/to/virtualenv/bin/python: Mach-O executable i386
Good luck!
No comments:
Post a Comment