本文介绍了如何打造64位的Python在OS X 10.6 - 只有64位,没有通用的废话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想在自己的计算机建立这个 - 二进制从Python.org安装仍是32位,并安装扩展(MySQLdb的,例如)是推动我与试图找出正确的标志每个螺母和每一个扩展。

I just want to build this on my development machine -- the binary install from Python.org is still 32 bits and installing extensions (MySQLdb, for example) is driving me nuts with trying to figure out the proper flags for each and every extension.

澄清:我没有更换系统的Python,我刚安装了Python.org二进制到其在/正常位置库/ ...,而不是/系统/库/....

Clarification: I did NOT replace the system Python, I just installed the Python.org binary into its normal place at /Library/..., not /System/Library/....

一切似乎来构建64位在默认情况下,默认的Python 2.6.1为64位(前,我与Python.org取代它建立认定它是直接替换)`

Everything else seems to build 64 bit by default, and the default Python 2.6.1 was 64 bit (before I replaced it with the Python.org build figuring it was a direct replacement)`

我只想要一个64位只建立,将运行在我的一台机器,没有任何冗余代码。

I just want a 64 bit only build that will run on my one machine without any cruft.

有没有人有一个简单的答案?

Does anyone have a simple answer?

谢谢了,ssteine​​[email protected]

Thanks much, [email protected]

推荐答案

如果你碰巧使用 MacPorts的,就这么简单指定告诉它不要编译通用,变体像这样:

If you happen to be using MacPorts, it's as simple as specifying the variant that tells it not to compile Universal, like so:

sudo port install python26 -universal

您可以使用变种查看可用的变种命令:

% port variants python26
python26 has the variants:
   darwin: Platform variant, selected automatically
   no_tkinter: Disable Tkinter support, which will break IDLE
   ucs4: Enable support for UCS4
   universal: Build for multiple architectures

正如你所看到的,默认情况下在10.6它建立了达尔文变种,它建立仅x86_64的:

As you can see, by default on 10.6 it builds the darwin variant, which builds ONLY x86_64:

% cd /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/
% file python2.6
python2.6: Mach-O 64-bit executable x86_64

比较默认的Python二进制,这是普遍的:

Compare to default python binary, which is Universal:

% file /usr/bin/python
/usr/bin/python: Mach-O universal binary with 3 architectures
/usr/bin/python (for architecture x86_64):      Mach-O 64-bit executable x86_64
/usr/bin/python (for architecture i386):        Mach-O executable i386
/usr/bin/python (for architecture ppc7400):     Mach-O executable ppc

如果你不使用MacPorts的,我建议你考虑一下。它节省了大量的时间和心痛不必手动配置和编译一切,有一个被称作一个很好的GUI界面 Porticus 。所有的免费和开源的,当然!

If you're not using MacPorts, I suggest you consider it. It saves a lot of time and heartache having to manually configure and compile everything, and there is an excellent GUI interface called Porticus. All free and open source, of course!

P.S。 永远不要的替换或重命名原始系统二进制文件!作为建议由斯内德日报评论:

p.s. Never replace or rename the original system binaries! As suggested in the comments by Ned Daily:

无论是管理进入到预期  通过改变搜索蟒蛇实例  为了在PATH环境变量  或者,如果需要的话,使用绝对路径  像/opt/local/bin/python2.6。

这篇关于如何打造64位的Python在OS X 10.6 - 只有64位,没有通用的废话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 22:09