在 OSX 上,我有一个 Python 通用二进制文件,它只包含 32 位代码:
$ file $(python3.2-32)
/Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2-32: Mach-O universal binary with 1 architecture
/Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2-32 (for architecture i386): Mach-O executable i386
我使用这个二进制文件创建了一个 virtualenv:
$ virtualenv -p python3.2-32 myenv
Running virtualenv with interpreter /Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2-32
New python executable in myenv/bin/python
Please make sure you remove any previous custom paths from your /Users/jhartley/.pydistutils.cfg file.
Installing distribute........................................................................................................................................................................done.
Installing pip...............done.
但是 virtualenv 包含一个包含 32 位和 64 位代码的二进制文件:
$ . myenv/bin/activate
(myenv)$ file $(which python)
/Users/jhartley/myenv/bin/python: Mach-O universal binary with 2 architectures
/Users/jhartley/myenv/bin/python (for architecture i386): Mach-O executable i386
/Users/jhartley/myenv/bin/python (for architecture x86_64): Mach-O 64-bit executable x86_64
我需要使用仅包含 32 位代码而不是 64 位代码的 Python 二进制文件。
我不介意它是一个通用二进制文件,只要它默认以 32 位模式运行,我不必使用“arch -i386”调用它,因为我无法控制这个应用程序的启动方式.