在 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>
有人可以帮忙吗?
非常感谢
请注意,此 post 假定您已安装 homebrew 并且正尝试在 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)。
Mow 签入 python REPL shell...
import igraph.test
igraph.test.run_tests()
如果一切正常,那么 python 中的 igraph 可以为您工作
还要检查这个:
from igraph import *
g = Graph.Famous("petersen")
plot(g)
你应该得到一个漂亮的彼得森图(红色节点,小图)
我执行了 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>
有人可以帮忙吗? 非常感谢
请注意,此 post 假定您已安装 homebrew 并且正尝试在 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)。
Mow 签入 python REPL shell...
import igraph.test
igraph.test.run_tests()
如果一切正常,那么 python 中的 igraph 可以为您工作
还要检查这个:
from igraph import *
g = Graph.Famous("petersen")
plot(g)
你应该得到一个漂亮的彼得森图(红色节点,小图)