【发布时间】:2015-01-14 20:48:38
【问题描述】:
我尝试在 Anaconda 上安装 igraph 包,但到目前为止还没有成功。如果有人想办法得到它,我会很乐意尝试的!!下面是我尝试做的一些细节(如果你有在 Anaconda 上安装 igraph 的解决方案,你不必阅读它!)。
我使用的是 MAC OS X Yosemite(MAC book Pro 2,3 GHz Intel Core i7)。以下是一些配置参数: MBP-de-Lecue:site-packages lecueguillaume$ which python /用户/lecueguillaume/anaconda/bin/python MBP-de-Lecue:site-packages lecueguillaume$ which pip /Users/lecueguillaume/anaconda/bin/pip
igraph 应该通过 pip 安装。因为,当我输入 pip list 时,我可以在列表中看到包 igraph
python-igraph (0.7)
但是当我尝试在这里导入 igraph 时,我得到了:
MBP-de-Lecue:site-packages lecueguillaume$ python Python 2.7.8 |Anaconda 2.1.0 (x86_64)| (默认,2014 年 8 月 21 日,15:21:46) [GCC 4.2.1 (Apple Inc. build 5577)] 在 darwin 上
导入 igraph 回溯(最近一次通话最后): 文件“”,第 1 行,在 文件“build/bdist.macosx-10.5-x86_64/egg/igraph/init.py”,第 34 行,在
文件“build/bdist.macosx-10.5-x86_64/egg/igraph/_igraph.py”,第 7 行,在 bootstrap 中的文件“build/bdist.macosx-10.5-x86_64/egg/igraph/_igraph.py”,第 6 行 ImportError:dlopen(/Users/lecueguillaume/.python-eggs/python_igraph-0.7-py2.7-macosx-10.5-x86_64.egg-tmp/igraph/_igraph.so,2):未加载库:libxml2.2.dylib 引用自:/Users/lecueguillaume/.python-eggs/python_igraph-0.7-py2.7-macosx-10.5-x86_64.egg-tmp/igraph/_igraph.so 原因:库版本不兼容:_igraph.so需要12.0.0或更高版本,而libxml2.2.dylib提供10.0.0版本
所以问题来自libxml2-2。我尝试使用 brew 升级 libxml: MBP-de-Lecue:site-packages lecueguillaume$ brew upgrade libxml2 错误:已经安装了 libxml2-2.9.2
1) 我不明白的第一件事是 libxml2.2 版本 12.0.0 似乎不存在。 http://xmlsoft.org 的最新版本是 9.2。那么为什么 igraph 要求版本 12.0 ? (我当然错过了什么)。
brew没有帮助的事实是因为它没有更新正确的libxml: MBP-de-Lecue:site-packages lecueguillaume$ which brew /usr/local/bin/brew
2) 我怎么能说 brew 来更新 anaconda/pkgs 中的 Anaconda libxml 库
3) 我还尝试使用 conda pipbuild python-igraph 安装图形。一切顺利:成功安装 python-igraph 除了它必须自己安装 igraph 的 C 核心,而我已经安装了它: 安装收集的包:python-igraph 为 python-igraph 运行 setup.py install 使用 pkg-config 在此系统上找不到 igraph 的 C 核心。 我们现在将尝试从头开始下载和编译 C 内核。 C核版本号:0.7 我们也会尝试:0.7.0
所以看起来 conda 安装运行良好,但“导入 igraph”仍然不起作用。
4) 最后,当我使用 python 的内置 MAC 版本时,igraph 运行良好: MBP-de-Lecue:site-packages lecueguillaume$ which python2.7 /opt/local/bin/python2.7 MBP-de-Lecue:站点包 lecueguillaume$ python2.7 Python 2.7.8(默认,2014 年 7 月 13 日,17:11:32) [GCC 4.2.1 兼容 Apple LLVM 5.1 (clang-503.0.40)] 在 darwin 输入“help”、“copyright”、“credits”或“license”了解更多信息。
导入 igraph
所以 igraph 在 python 的 MAC 版本中安装得很好,但在 Anaconda 版本中没有。由于我使用 Anaconda Notebook(可与 Anaconda python 配合使用),因此我想在其上安装 igraph。
抱歉,问题太长了(这是我第一次提出问题)。我对graphviz包也有同样的问题(安装在MAC python2.7版本上,但没有安装在Anaconda python版本上)。
非常感谢您的帮助!
纪尧姆。
【问题讨论】:
标签: macos python-2.7 igraph anaconda pygraphviz