2011-12-06 58 views
7

我想知道是否有人可以幫我弄清楚這一點。當我嘗試蟒蛇setup.py版本(或PIP安裝,或使用easy_install),這種情況需要幫助在mac os上安裝python package autopy x - libpng和png.h的難度

要點是

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中,它在<> includes(包括我用cpp -v檢查)的搜索路徑上,但它作爲libpng.framework在那裏,然後這些頭文件位於名爲頭文件的子目錄中。在libpng.framework文件中還有幾個libpng版本。我也運行64位Python。任何想法如何繼續?

感謝, 帕特

回答

2

的錯誤是,當你猜到了,因爲編譯器找不到頭文件png.h

你能告訴我是如何被包含在框架?你在使用-I和-L嗎?

爲包括GCC框架正確的語法是

GCC -F * DIR *

GCC -iframework * DIR *

希望這有助於

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

-F dir 將框架目錄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.