需要帮助在 mac os x 上安装 python 包 autopy - libpng 和 png.h 的困难
我想知道是否有人可以帮我解决这个问题。当我尝试 python setup.py build (或 pip install 或 easy_install)时,会发生这种情况,
要点是
src/png_io.c:3:17: error: png.h: No such file or directory
src/png_io.c: In function ‘newMMBitmapFromPNG’:
src/png_io.c:34: error: ‘png_struct’ undeclared (first use in this function)
src/png_io.c:34: error: (Each undeclared identifier is reported only once
......一堆错误......
src/png_io.c:332: error: ‘PNG_TRANSFORM_IDENTITY’ undeclared (first use in this function)
lipo: can't figure out the architecture type of: /var/folders/kt/d8t29zkx7kd_7c_mr17ntv6m0000gn/T//ccubs4CM.out
error: command 'gcc-4.2' failed with exit status 1
libpng 位于 Library/Frameworks 中,它位于 << 的搜索路径上>包含(我用 cpp -v 检查过),但它作为 libpng.framework 存在,然后标头位于名为 headers 的子目录中。 libpng.framework 文件中还有多个版本的 libpng。我也在运行 64 位 python。有什么想法如何继续吗?
谢谢, 拍
I was wondering if anyone could help me figure this out. When i try to python setup.py build (or pip install, or easy_install), this happens
the gist is
src/png_io.c:3:17: error: png.h: No such file or directory
src/png_io.c: In function ‘newMMBitmapFromPNG’:
src/png_io.c:34: error: ‘png_struct’ undeclared (first use in this function)
src/png_io.c:34: error: (Each undeclared identifier is reported only once
... bunch of errors ...
src/png_io.c:332: error: ‘PNG_TRANSFORM_IDENTITY’ undeclared (first use in this function)
lipo: can't figure out the architecture type of: /var/folders/kt/d8t29zkx7kd_7c_mr17ntv6m0000gn/T//ccubs4CM.out
error: command 'gcc-4.2' failed with exit status 1
libpng is in Library/Frameworks, which is on the search path for < > includes (i checked with cpp -v), but its in there as libpng.framework, and then the headers are in a subdirectory called headers. There are also several versions of libpng in the libpng.framework file. I'm also running 64bit python. Any ideas how to proceed?
Thanks,
Pat
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如您所猜测的,错误是因为编译器找不到头文件 png.h
您能告诉我框架是如何包含的吗?您使用-I 和-L 吗?
将框架包含在 GCC 中的正确语法是
gcc -F*dir*
或
gcc -iframework*dir*
希望这
对 http://gcc.gnu.org/onlinedocs/gcc/Darwin-Options.html
-Fdir
将框架目录dir添加到要搜索头文件的目录列表的头部。这些目录与 -I 选项指定的目录交错,并按从左到右的顺序扫描。
The error is, as you guessed, because the compiler can't find the header file png.h
Can you tell me how the framework is being included? Are you using -I and -L?
The correct syntax for including a framework with GCC is
gcc -F*dir*
or
gcc -iframework*dir*
Hope this helps
From http://gcc.gnu.org/onlinedocs/gcc/Darwin-Options.html
-Fdir
Add the framework directory dir to the head of the list of directories to be searched for header files. These directories are interleaved with those specified by -I options and are scanned in a left-to-right order.
在这种特殊情况下,这是因为您缺少 libpng。 (带有 png.h 的框架)
您可以从 http://ethan.tira-thompson 安装它。 com/Mac_OS_X_Ports.html 然后重新运行 autopy 安装,你应该可以开始了!
In this particular case, it's because you're missing libpng. (The framework with png.h)
You can install it from http://ethan.tira-thompson.com/Mac_OS_X_Ports.html then re-run the autopy install and you should be good to go!