我试图在 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 /Users/lecueguillaume/anaconda/bin/python MBP-de-Lecue:site-packages lecueguillaume$ which pip /Users/lecueguillaume/anaconda/bin /点
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 Traceback(最近一次调用最后):文件“”,第 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 行,在文件“build/bdist.macosx-10.5-x86_64/egg/igraph/_igraph.py”,第 6 行,在bootstrap 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 Error: libxml2-2.9.2 already installed
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运行setup.py install for python-igraph找不到C核心igraph 在这个系统上使用 pkg-config。我们现在将尝试从头开始下载和编译 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 :site-packages lecueguillaume$ python2.7 Python 2.7.8 (default, Jul 13 2014, 17:11:32) [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin 输入“帮助”, “版权”、“学分”或“许可”以获取更多信息。
导入 igraph
所以 igraph 在 python 的 MAC 版本中安装得很好,但在 Anaconda 版本中没有。由于我使用 Anaconda Notebook(可与 Anaconda python 配合使用),因此我想在其上安装 igraph。
很抱歉这个问题很长(这是我第一次提出问题)。我对 graphviz 包也有同样的问题(安装在 MAC python2.7 版本上,但没有安装在 Anaconda python 版本上)。
非常感谢您的帮助!
纪尧姆。