gpt4 book ai didi

python - 在 mac 上安装 python igraph

转载 作者:行者123 更新时间:2023-11-28 22:25:13 25 4
gpt4 key购买 nike

我执行了 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>

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

最佳答案

注意这篇文章假设你有 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)

你应该得到一个漂亮的彼得森图(红色节点,小图)

关于python - 在 mac 上安装 python igraph,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45667147/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com