尝试使用 Python 2.7.2 在 64 位 Mac 10.6 机器上安装 pygame 1.9.1(32 位)时出现导入错误

发布于 2024-12-24 02:41:25 字数 1554 浏览 0 评论 0原文

***更新:以下是我遇到的错误:

>>> import pygame

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pygame
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 95, in <module>
    from pygame.base import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so, 2): no suitable image found.  Did find:
    /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so: no matching architecture in universal wrapper

>>> arch -i386 /usr/bin/python2.7

SyntaxError: invalid syntax

>>> arch -i386 python2.7

SyntaxError: invalid syntax

>>> arch -i386 /usr/local/bin/python2.7

SyntaxError: invalid syntax

>>> arch -i386 python

SyntaxError: invalid syntax

如果其中一些是我应该在其他地方输入的 Unix 命令,请告诉我。

我正在尝试使用Python 2.7.2在64位Mac 10.6机器上安装pygame 1.9.1(32位)(我还在同一台机器上安装了Python 3.2)。我使用的是从网站下载的Python版本,而不是预安装的版本。我尝试了以下解决方案(从这里开始:如何在 Snow Leopard 上强制 Python 为 32 位以及其他 32 位/64 位问题),但它们不起作用对我来说:(

export VERSIONER_PYTHON_PREFER_32_BIT=yes
arch -i386 /usr/bin/python2.6

我还尝试重命名最后一个字符串 python2.7 并仅重命名 python)

我已在 Python 2.7.2 shell 中输入所有这些“解决方案”。如果您有任何其他想法,请告诉我,非常感谢您的帮助。如果您能详细解释如何实施该解决方案以及该解决方案的作用,我将不胜感激。

***Update: Here are the errors I am getting:

>>> import pygame

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pygame
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 95, in <module>
    from pygame.base import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so, 2): no suitable image found.  Did find:
    /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so: no matching architecture in universal wrapper

>>> arch -i386 /usr/bin/python2.7

SyntaxError: invalid syntax

>>> arch -i386 python2.7

SyntaxError: invalid syntax

>>> arch -i386 /usr/local/bin/python2.7

SyntaxError: invalid syntax

>>> arch -i386 python

SyntaxError: invalid syntax

If some of these are Unix commands that I should be entering somewhere else, please let me know.

I am trying to install pygame 1.9.1 (32bit) on 64 bit Mac 10.6 machine with Python 2.7.2 (I also have Python 3.2 installed on the same machine). I am using the Python versions downloaded from the website, not the preinstalled versions. I tried the following solutions (from here: How do I force Python to be 32-bit on Snow Leopard and other 32-bit/64-bit questions), but they didn't work for me:

export VERSIONER_PYTHON_PREFER_32_BIT=yes
arch -i386 /usr/bin/python2.6

(I also tried with renaming the last string python2.7 and just python)

I have entered all of these 'solutions' in the Python 2.7.2 shell. Please let me know if you have any other ideas and thanks so much for the help. I would appreciate if you could explain how to implement the solution in detail and what the solution does.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

×纯※雪 2024-12-31 02:41:25

正如您链接到的答案的评论中所指出的,解决方案 1 仅适用于 Apple 提供的 Python,不适用于从其他地方安装的 Python。 Apple 安装的 Python 可从 /usr/bin 访问;一般来说,从python.org或其他地方安装的Python可以直接作为python2.7(没有/usr/bin)或可能作为<代码>/usr/local/bin/python2.7。使用这些路径之一尝试解决方案 2,即:

arch -i386 python2.7

As noted in the comments of the answer you linked to, solution 1 only works with the Apple-supplied Pythons, not Pythons installed from elsewhere. The Apple-installed Pythons are accessed from /usr/bin; generally, Pythons installed from python.org or elsewhere will be accessible as just python2.7 (no /usr/bin) or possibly as /usr/local/bin/python2.7. Try solution 2 using one of those paths, i.e.:

arch -i386 python2.7
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文