我执行了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 或空闲终端(我使用空闲)。
在 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/