python - 需要帮助在 mac os x 上安装 python 包 autopy - libpng 和 png.h 有困难

标签 python c macos gcc libpng

我想知道是否有人可以帮我解决这个问题。当我尝试 python setup.py 构建(或 pip 安装或 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,然后 header 位于名为 headers 的子目录中。 libpng.framework 文件中也有几个版本的libpng。我也在运行 64 位 python。对如何进行有任何想法吗?

谢谢, 帕特

最佳答案

错误如你所料,是因为编译器找不到头文件png.h

你能告诉我框​​架是如何被包含进来的吗?您使用的是 -I 和 -L 吗?

用 GCC 包含框架的正确语法是

gcc -F*目录*

gcc -iframework*目录*

希望对你有帮助

来自 http://gcc.gnu.org/onlinedocs/gcc/Darwin-Options.html

-目录 将框架目录 dir 添加到要搜索头文件的目录列表的头部。这些目录与 -I 选项指定的目录交错排列,并按从左到右的顺序扫描。

A framework directory is a directory with frameworks in it. A framework is a directory with a Headers and/or PrivateHeaders directory contained directly in it that ends in .framework. The name of a framework is the name of this directory excluding the .framework. Headers associated with the framework are found in one of those two directories, with Headers being searched first. A subframework is a framework directory that is in a framework's Frameworks directory. Includes of subframework headers can only appear in a header of a framework that contains the subframework, or in a sibling subframework header. Two subframeworks are siblings if they occur in the same framework. A subframework should not have the same name as a framework, a warning will be issued if this is violated. Currently a subframework cannot have subframeworks, in the future, the mechanism may be extended to support this. The standard frameworks can be found in /System/Library/Frameworks and /Library/Frameworks. An example include looks like #include <Framework/header.h>, where Framework denotes the name of the framework and header.h is found in the PrivateHeaders or Headers directory.

关于python - 需要帮助在 mac os x 上安装 python 包 autopy - libpng 和 png.h 有困难,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8394157/

相关文章:

python - 从包含在 shapefile 边界内的 netcdf 文件中提取数据

python - 返回组中所有唯一的聚合

c - 当 str1 中的字符匹配时,如何删除 str2 中的字符?

c - 如何使用 VC++ 编译器刷新 .C 程序中的标准输入设备?

c++ - pthread_cond_wait 不解锁互斥量

python - 如何查询 Pandas 中的数字列名称?

python - 如何处理 : ImportError:/usr/lib/x86_64-linux-gnu/libatk-1. 0.so.0: undefined symbol: g_log_structured_standard

c - 通过c中的函数传递文件

macos - 如何一次在mac中的多个文件名中附加相同的字符串?

linux - 使 Mac 快捷方式(例如 Cmd-C)在 linux 上工作