我可以在 OS X 上安装现有 32 位版本的 Python 2.7.1 64 位版本吗?
简短描述
是否可以从 python.org 安装 Python 2.7.1 64/32bit Python 2.7.1 32 位的现有安装(来自 python.org)?
背景
我安装了 wxPython(2.8) 支持的 32 位版本,到目前为止,它给我带来了零问题。我现在很难安装一些模块(psycopg2 和 mysql-python)。 homebrew 中的警告消息不断警告我路径上没有 64 位版本的 Python。这些警告只会添加到我想要使用 64 位版本的列表中。
当我选择 32 位安装时,特定项目的 GUI 是主要关注点。现在 GUI 已经变得非常简单,数据库后端支持(使用 Django)更加重要。话虽这么说,使用 wxPython 2.9 的开发版本(支持 OS X 和 64 位 2.7)已经变得可以接受。
对于非 Mac 用户,为了帮助解释为什么我必须使用 32 位版本,请参阅此 使用 virtualenv 的简要指南在wxpython项目中
系统信息
开发系统
操作系统:Mac OS X Snow Leopard (10.6.7)
Python: 2.7.1,带有 virutalenv / virutalenv-wrapper
项目依赖项:
请注意,如果我可以使用自制程序安装 postgresql,则 MySQL 可能是 PostgresSQL 的 psycopg2
Django==1.2.5
MySQL-python==1.2.3
PIL==1.1.7
PyVISA==1.3
pyserial==2.5
virtualenv==1.5.1
virtualenvwrapper==2.6.3
wsgiref==0.1.2
wxPython==2.8.11.0
wxPython-common==2.8.11.0
部署系统
操作系统: Windows XP / Windows 7
Python:希望没有(目标是使用 py2exe 或类似工具)
当前想法
我担心仅根据文件路径无法实现我的目标。在 Windows 7 中,标识符 (x86) 放置在路径中,表明它是 32 位程序,但在 OS X 上,32 位或 64/32 位安装的路径是相同的 (/Library/Frameworks/Python.framework/Versions/ 2.7/)。
任何想法或评论都会有帮助!
2011 年 5 月 18 日更新:上午 8:40
我已经确认,使用预编译 (.dmg) 框架构建,安装 64 位版本确实会击败 32 位安装。这确实对我的虚拟环境产生了负面影响,因为我在环境中安装的所有东西都是基于 32 位安装的,几乎每个模块都会引发某种错误。
我仍然没有实现在同一台机器上安装 32 位和 64 位,但是更详细地研究 homebrew看起来这可能是可能的。诀窍是为每个 python 构建(从源代码)定义您自己的公式,并将安装目录重命名为“Python27_32”和“Python27_64”之类的名称。只要有时间,我将继续探索这方面的内容。
编辑 2011 年 7 月 12 日:上午 10:51(美国中部标准时间)
有没有人能够控制自制程序编译选项的方式?具体如何选择使用64位编译器还是32位编译器?如果这没有提出任何问题,我将创建一个新的问题。
Short Description
Is it possible to install Python 2.7.1 64/32bit from python.org on top of an existing install (from python.org) of Python 2.7.1 32bit?
Background
I installed the 32bit version for wxPython(2.8) support which until now has given me zero issues. There are a few modules that I am now having difficultly installing (psycopg2 and mysql-python). The warning messages in homebrew constantly warn me about not having a 64bit version of Python on the path. These warnings only add to my list of wanting to use a 64 bit version.
At the time I selected the 32bit install, the GUI for a particular project was the main focus. Now the GUI has been come very simple and the database back-end support (using Django) is much more important. This being said, using the development version of wxPython 2.9 (which supports OS X and 64bit 2.7) has become acceptable.
For the non-mac users, to help explain why I had to use the 32bit version please see this Brief guide to using virtualenv in a wxpython project
System Information
Development System
OS: Mac OS X Snow Leopard (10.6.7)
Python: 2.7.1 with virutalenv / virutalenv-wrapper
Project Dependencies:
Note that MySQL could be PostgresSQL's psycopg2 if I can get the postgresql to install with homebrew
Django==1.2.5
MySQL-python==1.2.3
PIL==1.1.7
PyVISA==1.3
pyserial==2.5
virtualenv==1.5.1
virtualenvwrapper==2.6.3
wsgiref==0.1.2
wxPython==2.8.11.0
wxPython-common==2.8.11.0
Deployment System
OS: Windows XP / Windows 7
Python: Hopefully none (goal to use py2exe, or similar tool)
Current Thoughts
I fear that my goal cannot be accomplished based on the file paths alone. In Windows 7 the identifier (x86) is placed in the path showing that it is a 32bit program, but on OS X the path would be the same for 32bit or 64/32bit installs (/Library/Frameworks/Python.framework/Versions/2.7/).
Any thoughts or comments would be helpful!
Update 5-18-2011: 8:40 AM
I have confirmed that using the pre-compiled (.dmg) framework builds, installing the a 64 bit version does blow away the 32 bit install. This did negatively effect my virtual environments in that all of the things I have installed in the environments was based on the 32 bit install nearly every module threw an error of some sort.
I still have not achieved installing 32 bit and 64 bit on the same machine, however looking into homebrew with greater detail does look this could be possible. The trick would be to define your own formulas for each of the python builds (from source) and rename the install directory to something like 'Python27_32' and 'Python27_64'. I'll keep exploring this front as I have time.
EDIT 7-12-2011: 10:51 AM CST
Has anyone out there been able control how homebrew compile options? Specifically how to select to use a 64bit compiler or a 32 bit compiler? I will create a new SO question if this doesn't bring anything up.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查看 http://www.macports.org/ 它提供了各种风格的 linux/unix 工具的端口不会出现在默认的 Mac 安装中,并且会重复其他需要的安装。它将所有内容安装在 /opt/local 中,而不是踩在已安装的基础上。通过对 PATH 和 LD_LIBRARY_PATH 进行一些操作,这可能会为您提供所需的选项。
Check out http://www.macports.org/ Which provides ports of various flavors of linux/unix tools that don't appear in the default MacInstallation and duplicates those that it needs otherwise. It installs everthing in /opt/local instead of stepping on the installed base. With some manipulation of PATH and LD_LIBRARY_PATH this might give you the options you need.
我会使用类似 virtualenv 的东西。这样你就可以根据需要安装任意数量的不同版本的 python。
编辑:要使用不同版本的python,请使用:
参考
I would use something like virtualenv. This way you can have as many different installs of python as you wish.
EDIT: To use different versions of python use:
Reference
在回答我的一个问题时提供的另一个可能的解决方案是使用构建。这种方法看起来可以让我创建一个安装了 32 位的环境和另一个安装了 64 位的环境。
我还没有对此进行测试,但想将其传递给尝试此壮举的其他人。
干杯!
Another possible solution that was provided in an answer to one of my questions aimed at using a virtual environment in the Windows world was using Buildout. This approach looks like it would allow me create an environment with the 32bit installed and another one with the 64bit.
I have not tested this out yet, but wanted to pass it along to anyone else attempting this feat.
Cheers!