py2cairo的构建在带有Homebrew的Mac OS X中失败 [英] Build of py2cairo fails in Mac OS X with Homebrew

查看:167
本文介绍了py2cairo的构建在带有Homebrew的Mac OS X中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经做出了值得商decision的决定,即直接在Python中而不是R中进行一些网络分析.但是,我在安装所有igraph依赖项时遇到了麻烦,最终py2cairo失败了.

将Xcode更新到最新版本后,用Homebrew安装cairo:

brew install cairo

那里有一些关于依赖库的警告,并且brew link步骤失败.整理好几个目录后,我再次运行brew link并成功.

然后,我使用pip卸载并重新安装了python-igraph.

现在,我需要从源代码安装py2cairo(我正在virtualenv中运行Python 2.7.6),因此从此源代码下载了它:

git clone git://git.cairographics.org/git/py2cairo

在virtualenv中安装pycairo 之后,我没有任何问题地运行了./waf configure --prefix=$VIRTUAL_ENV.

运行./waf build时出现以下错误:

ld: warning: ignoring file /usr/local/Cellar/cairo/1.14.2_1/lib/libcairo.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/Cellar/cairo/1.14.2_1/lib/libcairo.dylib
[...]
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

然后我尝试切换为使用autogen.sh.第一个问题是我的计算机上缺少pkg.m4,因此我尝试再次使用Homebrew重新安装pkg-config.没用因此,我从此处 http:下载了pkg.m4://web.mit.edu/barnowl/src/pkg-config/pkg-config-0.23/pkg.m4 ,然后将libtools与Homebrew一起安装,并将autogen中的引用更改为glibtoolize等./p>

但是autogen.sh终止并出现以下错误:

autogen.sh: running `aclocal'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/m4:/usr/local/Cellar/automake/1.15/share/aclocal/pkg.m4:155: ERROR: end of file in comment
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: error: echo failed with exit status: 1

解决方案

export ARCHFLAGS='-arch x86_64' # this is for Mac os x ./waf clean ./waf configure --prefix=`python -c "import sys; print sys.prefix"` ./waf build ./waf install

这在我的Mac上效果很好

I've made the debatable decision to do some network analysis directly in Python instead of R. However, I'm having trouble getting all the igraph dependencies installed, ultimately failing with py2cairo.

After updating Xcode to latest, installed cairo with Homebrew:

brew install cairo

A few warnings there for dependent libraries, and the brew link step failed. After chowning a few directories, I ran brew link again and it worked.

Then, I uninstalled and re-installed python-igraph using pip.

Now I need to install py2cairo from source (I'm running Python 2.7.6 in a virtualenv) and so downloaded it from this source:

git clone git://git.cairographics.org/git/py2cairo

Following Install pycairo in virtualenv, I ran ./waf configure --prefix=$VIRTUAL_ENV with no problems.

Running ./waf build falls over with these errors:

ld: warning: ignoring file /usr/local/Cellar/cairo/1.14.2_1/lib/libcairo.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/Cellar/cairo/1.14.2_1/lib/libcairo.dylib
[...]
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I then tried to switch to using autogen.sh. First problem was that pkg.m4 was missing on my machine, so I tried reinstalling pkg-config with Homebrew again. Didn't work. So I downloaded pkg.m4 from here http://web.mit.edu/barnowl/src/pkg-config/pkg-config-0.23/pkg.m4, then installed libtools with Homebrew, and changed references in autogen to glibtoolize etc.

But then autogen.sh terminates with following errors:

autogen.sh: running `aclocal'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/m4:/usr/local/Cellar/automake/1.15/share/aclocal/pkg.m4:155: ERROR: end of file in comment
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: error: echo failed with exit status: 1

解决方案

export ARCHFLAGS='-arch x86_64' # this is for Mac os x ./waf clean ./waf configure --prefix=`python -c "import sys; print sys.prefix"` ./waf build ./waf install

This works well on my Mac

这篇关于py2cairo的构建在带有Homebrew的Mac OS X中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆