在OS X Lion上安装Cairo

时间:2012-06-25 14:36:47

标签: python macos cairo pycairo

当我尝试使用Python 2.7.2在OS X Lion上安装Cairo时,它只是不起作用,我可以构建和安装它,但是当它在python中导入cairo时,它无法找到。我试过了How to install PyCairo 1.10 on Mac OSX with default ,它只是产生了这个错误

 "_cairo_xlib_surface_get_width", referenced from:
  _xlib_surface_get_width in surface.c.1.o

ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/l9/71rhp2vs7w34bm4x6mfwms500000gn/T//cc1fcO7s.out (No such file or directory)
Waf: Leaving directory `/Users/andrewlynch/Downloads/py2cairo-1.10.0/build_directory'
Build failed
 -> task failed (exit status 1): 
    {task 4550820944: cshlib cairomodule.c.1.o,context.c.1.o,font.c.1.o,path.c.1.o,pattern.c.1.o,matrix.c.1.o,surface.c.1.o -> _cairo.so}
['/usr/bin/gcc', 'src/cairomodule.c.1.o', 'src/context.c.1.o', 'src/font.c.1.o', 'src/path.c.1.o', 'src/pattern.c.1.o', 'src/matrix.c.1.o', 'src/surface.c.1.o', '-o', '/Users/andrewlynch/Downloads/py2cairo-1.10.0/build_directory/src/_cairo.so', '-L/usr/local/Cellar/cairo/1.10.2/lib', '-lcairo', '-lpython2.7', '-dynamiclib', '-Wl,-F.', '-arch', 'i386', '-arch', 'x86_64', '-Wl,-F.', '-Wl,-F.', '-arch', 'i386', '-arch', 'x86_64', '-arch', 'i386', '-arch', 'x86_64']}

1 个答案:

答案 0 :(得分:2)

我尝试在OSX Lion上安装PyCairo时有类似的经历。默认安装尝试使用体系结构i386进行安装。您需要将其更改为64位架构x86_64。

我尝试将 CFLAGS CXXFLAGS 设置为'arch x86_64',但这不起作用。为了使它工作,我必须将 ARCHFLAGS 设置为此值。

export ARCHFLAGS="-arch x86_64"

希望这能为您解决问题。