0

我一直在努力使用 easy_install 在我的 Windows (XP) 安装上为 PyPy (2.1) 构建 Pillow。问题似乎与它缺少所需的 python/pypy 标头(?)有关。我已经在谷歌上下搜索了好几天,希望能找到一些可以详细说明我遇到的问题的人,但没有找到任何有用的东西。

我得到的错误日志是:

...

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox
/MD /W3 /GS- /DNDEBUG -IlibImaging -IC:\pypy-21\include -IC:\pypy-21\include /Tc
libImaging\UnsharpMask.c /Fobuild\temp.win32-2.7\Release\libImaging\UnsharpMask.obj

...
decode.obj : error LNK2001: unresolved external symbol __imp__PyType_Type
encode.obj : error LNK2001: unresolved external symbol __imp__PyType_Type
map.obj : error LNK2001: unresolved external symbol __imp__PyType_Type
encode.obj : error LNK2019: unresolved external symbol __imp___PyString_Resize r
eferenced in function __encode
encode.obj : error LNK2019: unresolved external symbol __imp__PyErr_SetFromErrno
 referenced in function __encode_to_file
encode.obj : error LNK2019: unresolved external symbol __imp__PyExc_SystemError
referenced in function __setimage
display.obj : error LNK2019: unresolved external symbol __imp__PyList_Append ref
erenced in function _list_windows_callback@8
display.obj : error LNK2019: unresolved external symbol __imp__PyErr_Print refer
enced in function _callback_error
display.obj : error LNK2019: unresolved external symbol __imp__PyFile_WriteStrin
g referenced in function _callback_error
display.obj : error LNK2019: unresolved external symbol __imp__PySys_GetObject r
eferenced in function _callback_error
display.obj : error LNK2019: unresolved external symbol _PyObject_CallFunction r
eferenced in function _windowCallback@16
path.obj : error LNK2001: unresolved external symbol _PyObject_CallFunction
display.obj : error LNK2019: unresolved external symbol __imp__PyThreadState_Swa
p referenced in function _windowCallback@16
display.obj : error LNK2019: unresolved external symbol __imp__PyThreadState_Get
 referenced in function _PyImaging_CreateWindowWin32
path.obj : error LNK2019: unresolved external symbol __imp__PyErr_ExceptionMatch
es referenced in function _PyPath_Flatten
path.obj : error LNK2019: unresolved external symbol __imp__PyNumber_Check refer
enced in function _PyPath_Flatten
path.obj : error LNK2019: unresolved external symbol __imp__PyExc_RuntimeError r
eferenced in function _path_clip_polygon
build\lib.win32-2.7\_imaging.pypy-21.pyd : fatal error LNK1120: 61 unresolved ex
ternals
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.e
xe' failed with exit status 1120

我真的很难明白为什么会这样,我实际上不知道。我可以轻松地为 CPython 构建包。

据我所知,还包括依赖项文件夹:“-IC:\pypy-21\include”(?)。

有关更多日志,您可以查看http://pastebin.com/raw.php?i=kKnNpRgr

编辑 - 解决方案

在获取 PyPy 2.2.1 之后,我发现我的“PyPy-21/Include”路径中确实缺少一些文件。所以.. Pillow 与新发现的标头一起安装得很好,并且运行完美!=)

4

1 回答 1

-1

PyPy 没有实现 CPython 中的整个 C 扩展模块 API。或者更确切地说,PyPy 实现了 Cext 模块最有可能使用的符号的合理子集,但 PyPY 无法在不吸入大部分 CPython 的情况下提供 CPython 提供的每个符号。我希望 CPython 对它暴露给外部代码的符号更加小心,但我不相信它是。

PyPy 最适合使用纯 Python 模块。它也可以运行(相当缓慢)C 扩展模块的一个子集。你可能会在试图让 PyPy 导入这个特定的 CPython C 扩展模块时打一场失败的战斗。

请记住,您不能在 PyPy 中 JIT C 代码。

于 2013-12-16T03:30:49.930 回答