简体   繁体   English

Macintosh Python:64位与32位问题

[英]Macintosh Python: 64-bit vs 32-bit problems

I'm trying to sort through a whole host of problems arising from upgrading my macintosh to 10.6. 我正试图解决因将macintosh升级到10.6而引起的一系列问题。 Most of the tools I need work, but a couple (scipy, wxpython) do not, and give error messages that are highly suggestive of my messing up something with 64-bit and 32-bit binaries. 我需要工作的大多数工具,但是一对(scipy,wxpython)没有,并且提供错误消息,这些消息高度暗示我弄乱了64位和32位二进制文​​件。

I'm currently running Python 2.7. 我目前正在运行Python 2.7。 I don't know whether it is a 32-bit or a 64-bit version. 我不知道它是32位还是64位版本。 How do I tell? 我怎么说?

What I'm most concerned about is that I have some bizarre mixture of 32-bit and 64-bit, and that I should scrap everything and reinstall. 我最关心的是我有一些32位和64位的奇怪混合,我应该废弃一切并重新安装。 If I do this, and I want to avoid as many build problems as possible, do I (1) install the 32-bit version, (2) install the 64-bit version and make sure everything I build is 64-bit enabled, or (3) something else. 如果我这样做,并且我想避免尽可能多的构建问题,我是否(1)安装32位版本,(2)安装64位版本并确保我构建的所有内容都是64位启用的,或(3)别的东西。

I've tried without luck to find web pages regarding this, since other people must have stumbled over these issue, but I apologize if I'm rehashing old issues here. 我试过没有运气找到有关这方面的网页,因为其他人一定是偶然发现了这些问题,但如果我在这里重新讨论旧问题,我会道歉。 I've also tried very hard not to type the offensive statement "I don't care about 32-bit vs 64-bit, I just want Python to work ", but, in effect, that's what I'm asking here. 我也非常努力地不输入令人反感的声明“我不关心32位与64位,我只是想让Python 工作 ”,但实际上,这就是我在这里要求的。

Heaps of gratitude to whomever can help me sort through this, and apologies if I'm just being dense. 对任何人的感激之情可以帮助我解决这个问题,并且如果我只是在密集而道歉。

I also had major problems upgrading, so you are not alone, only a bit late. 我也有升级的主要问题,所以你不是一个人,只是有点晚。

To figure out what kind of binary you have, the file command is your friend: 要弄清楚你有什么样的二进制filefile命令就是你的朋友:

$ file /usr/local/bin/python
/usr/local/bin/python: Mach-O universal binary with 2 architectures
/usr/local/bin/python (for architecture i386):  Mach-O executable i386
/usr/local/bin/python (for architecture x86_64):    Mach-O 64-bit executable x86_64

You may also be advised to use MacPorts or (even better) HomeBrew . 您可能还被建议使用MacPorts或(甚至更好) HomeBrew

If you are already using MacPorts and nothing works anymore, you may even want to uninstall it and start from scratch with Homebrew. 如果您已经在使用MacPorts并且不再有任何工作,您甚至可能想要卸载它并从头开始使用Homebrew。 It gets you quickly to a point where hell is less hot. 它可以让你快速到达地狱不太热的地步。 After that you only need to figure out how to compile that important esoteric library to the right architecture. 之后,您只需要弄清楚如何将这个重要的深奥库编译到正确的架构中。

For wxPython, try using this shebang as the first line of your script: 对于wxPython,尝试使用此shebang作为脚本的第一行:

#!/usr/bin/arch -arch i386 python2.7

Or running from the command line with 或者从命令行运行

arch -arch i386 python2.7 yourScript.py

Basically, your python executable should include both 32-bit and 64-bit versions, and the 'arch' command tells the system which one to run with. 基本上,你的python可执行文件应包括32位和64位版本,'arch'命令告诉系统运行哪一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM