我怎么告诉py2app使用/ include 32bit Python(对于wxPython)?

时间:2022-04-19 20:59:02

I'm using OS X Lion (10.7.3) and I'm trying to write a cross-platform, stand-alone GUI-based program using wxPython and py2app.

我正在使用OS X Lion(10.7.3),我正在尝试使用wxPython和py2app编写一个跨平台,独立的基于GUI的程序。

I tried to use Python 2.7.1 which comes shipped with Lion.

我尝试使用Lion附带的Python 2.7.1。

I got the wxPython2.8 binaries (wxPython2.8-osx-unicode-py2.7).

我得到了wxPython2.8二进制文件(wxPython2.8-osx-unicode-py2.7)。

I installed py2app via pip.

我通过pip安装了py2app。

This is my little test app:

这是我的小测试应用程序:

#!/usr/bin/python
import wx
app = wx.App()
frame = wx.Frame(None, -1, 'test.py')
frame.Show()
app.MainLoop()

This is my setup.py:

这是我的setup.py:

from setuptools import setup
setup(
    app=["test.py"],
    setup_requires=["py2app"],
)

wxPython 2.8 wants 32-bit mode, so I use the arch command:

wxPython 2.8需要32位模式,所以我使用arch命令:

arch -i386 /usr/bin/python2.7 test.py

How do I tell py2app to use/include 32bit Python?

我怎么告诉py2app使用/ include 32bit Python?

It is possible to manually exchange the relevant files in the app bundle, but that's a rather clumsy workaround. I could also use 64bit wxPython2.9, but there isn't a stable release available yet. Should I switch to cx_Freeze? What is the best practice here?

可以手动交换应用程序包中的相关文件,但这是一个相当笨拙的解决方法。我也可以使用64位wxPython2.9,但还没有稳定版本可用。我应该切换到cx_Freeze吗?这里的最佳做法是什么?

1 个解决方案

#1


0  

If you have 64 bit Python installed, then it will create a 64 bit application.
If you have 32 bit Python installed, then it will create a 32 bit application.

如果您安装了64位Python,那么它将创建一个64位应用程序。如果您安装了32位Python,那么它将创建一个32位应用程序。

If you have both installed, then what is created will depend on where Python collects it's libraries from, the 32 bit or 64 bit install folders.
On Windows, this depends on which Python executable is actually run. And this depends on which is first in your system or user PATH settings.

如果你已经安装了,那么创建的内容将取决于Python从32位或64位安装文件夹中收集库的位置。在Windows上,这取决于实际运行的Python可执行文件。这取决于系统或用户PATH设置中的第一个。

When you type python setup.py, Windows runs python.exe which python.exe is run from the command line depends on you PATH environemnt variable. Which is run if you douple click setup.py in explorer depends on you file associations with .py files.

当你键入python setup.py时,Windows运行python.exe,从命令行运行python.exe取决于你的PATH environemnt变量。如果您在资源管理器中单击setup.py,则运行哪个依赖于您与.py文件的文件关联。

You could easily make setup.py ensure the correct is being run by spawning a 32bit python instance from within an arbitrary one.

您可以轻松地使setup.py通过从任意一个中生成一个32位python实例来确保正确运行。

#1


0  

If you have 64 bit Python installed, then it will create a 64 bit application.
If you have 32 bit Python installed, then it will create a 32 bit application.

如果您安装了64位Python,那么它将创建一个64位应用程序。如果您安装了32位Python,那么它将创建一个32位应用程序。

If you have both installed, then what is created will depend on where Python collects it's libraries from, the 32 bit or 64 bit install folders.
On Windows, this depends on which Python executable is actually run. And this depends on which is first in your system or user PATH settings.

如果你已经安装了,那么创建的内容将取决于Python从32位或64位安装文件夹中收集库的位置。在Windows上,这取决于实际运行的Python可执行文件。这取决于系统或用户PATH设置中的第一个。

When you type python setup.py, Windows runs python.exe which python.exe is run from the command line depends on you PATH environemnt variable. Which is run if you douple click setup.py in explorer depends on you file associations with .py files.

当你键入python setup.py时,Windows运行python.exe,从命令行运行python.exe取决于你的PATH environemnt变量。如果您在资源管理器中单击setup.py,则运行哪个依赖于您与.py文件的文件关联。

You could easily make setup.py ensure the correct is being run by spawning a 32bit python instance from within an arbitrary one.

您可以轻松地使setup.py通过从任意一个中生成一个32位python实例来确保正确运行。