繁体   English   中英

在Mac上安装python igraph

[英]Install python igraph on mac

我执行brew install homebrew/science/igraph执行sudo pip3 install python-igraph ,出现以下错误

Cannot find the C core of igraph on this system using pkg-config.
We will now try to download and compile the C core from scratch.
Version number of the C core: 0.7.1.post6
We will also try: 0.7.1

Using temporary directory: /private/tmp/pip-build-35vcjf7l/python-igraph/tmp/igraph.4cz7yjcl
Downloading igraph-0.7.1.tar.gz... 0.28%error: <urlopen error retrieval incomplete: got only 992 out of 2967134 bytes>

有人可以帮忙吗? 非常感谢

请注意,本文假定您已安装自制软件 ,并尝试在Mac上安装。

为了避免python3 / python2的任何问题,我建议您使用python2,因为这是igraph库设计用来处理的。 我在Mac上执行了以下代码,一切正常。

在终端上在python2上安装igraph的说明,请执行以下几行:

brew install cairo
brew install py2cairo
brew install igraph 

现在,该行上方的最后一行将安装C核。 最终的终端线路是:

sudo pip install python-igraph

上面的代码行为python2安装了igraph,请注意,这些代码行大约需要2分钟才能完成

接下来打开python2或idle-from终端(我使用过idle)。

割入python REPL shell ...

import igraph.test
igraph.test.run_tests()

如果一切正常,那么您已经在python中为igraph工作了

还要检查以下一项:

from igraph import *
g = Graph.Famous("petersen")
plot(g)

您应该获得一个很好的彼得森图图形(红色节点,小图)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM