我尝试在我的 Mac OSX Lion 上为 PyPy 安装 Pygame 1.9.1 版。我先运行了 pypy config.py
和 pypy setup.py install
。我将配置添加到安装过程中,因为我看到它正在尝试使用普通 python 进行配置(安装正确,但会导致导入错误)。在安装过程中,有很多警告,例如:
src/overlay.c:44:5: warning: implicit declaration of function 'PyObject_Free' is invalid in C99 [-Wimplicit-function-declaration]
PyObject_Free ((PyObject*)self);
^
但它也为我提供了 2 个类似的错误:
In file included from src/scale_mmx.c:33:
src/scale_mmx64.c:424:27: error: invalid instruction mnemonic 'movsxl'
asm __volatile__( " /* MMX code for inner loop of X bilinear filter */ "
^
<inline asm>:1:191: note: instantiated into assembly here
/* MMX code for inner loop of X bilinear filter */ movl -36(%rbp), %ecx; pxor %mm0, %mm0; 1: movsxl (%rdi), ...
^~~~~~
In file included from src/scale_mmx.c:33:
src/scale_mmx64.c:499:27: error: invalid instruction mnemonic 'movsxl'
asm __volatile__( " /* MMX code for inner loop of X bilinear filter */ "
^
<inline asm>:1:191: note: instantiated into assembly here
/* MMX code for inner loop of X bilinear filter */ movl -36(%rbp), %ecx; pxor %mm0, %mm0; 1: movsxl (%rdi), ...
^~~~~~
2 errors generated.
在我看来,PyPy 卡在了生成似乎是 C 中的 block 注释的行上,这对我来说似乎相当愚蠢。我不明白为什么它将注释封装在 asm 和 volatile 中。但这是提供给我并在常规 python 中运行的代码。那么这是一个错误吗?还是我遗漏了什么?
最佳答案
PyPy 有可能有一些与 CPython 不同的#defines(出于好的或坏的原因)并且 pygame 选择使用其他东西(基于考虑不周的带有隐式假设的#else)试图编译无效的 C。我是虽然只是猜测,但您需要了解为什么以及如何在 CPython 上编译/不编译相同的代码。
关于osx-lion - 通过 Mac 在 PyPy 中安装 Pygame,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10681174/