在mac上安装python igraph

在mac上安装python igraph,python,igraph,Python,Igraph,我执行了brew安装自制/science/igraph 当我执行sudopip3安装pythonigraph时,我得到了以下错误 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

我执行了
brew安装自制/science/igraph
当我执行
sudopip3安装pythonigraph
时,我得到了以下错误

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>
无法使用pkg config在此系统上找到igraph的C内核。
我们现在将尝试从头开始下载和编译C核心。
C内核的版本号:0.7.1.6
我们还将尝试:0.7.1
使用临时目录:/private/tmp/pip-build-35vcjf7l/python-igraph/tmp/igraph.4cz7yjcl
正在下载igraph-0.7.1.tar.gz。。。0.28%误差:
有人能帮忙吗?
非常感谢

注意,这篇文章假设您已经安装并正在尝试在Mac上安装。

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

要在python2上安装igraph,请在终端中执行以下命令:

brew install cairo
brew install py2cairo
brew install igraph 
现在,第行上面的最后一行安装C-core。最终终端线路为:

sudo pip install python-igraph
上面这行安装了python2的igraph, 请注意,我完成这些行大约需要2分钟

接下来从终端打开python2或idle(我使用idle)

Mow签入python REPL shell

import igraph.test
igraph.test.run_tests()
如果一切看起来都正常,那么您就有了python中的igraph

也请检查此项:

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

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

现在我直接用sudo pip3安装我遵循了你的指导原则,但我面临着这个错误:
ImportError:dlopen(/Users/alexandreattia/Desktop/Work/py27_venv/lib/python2.7/site-packages/igraph//igraph.so,2):Symbol not found:\u iconv引用自:/Users/alexandreattia/Desktop/Work/py27\u-venv/lib/python2.7/site-packages/igraph//igraph.so中应为/Users/alexandreattia/Desktop/Work/py27\u-venv/lib/python2.7/site-packages/igraph//igraph.so
您知道如何修复它吗?您是否安装了homebrew并正在安装你在mac上吗?请提供您调用的创建错误的命令,这将帮助我帮助您。是的,我在Mac(High Sierra)上,我有自制软件(1.3.6)。这个错误是在运行Python2.7
importigraph
时创建的。非常感谢您,嗯,我要做的第一件事是查看homebrew在您的机器上安装igraph时的日志。我的第一个猜测是,homebrew使用的位置与python 2.7环境使用的位置不同。解决此问题的最简单方法是使用homebrew使用的python环境,而不是其他选项。要做到这一点,您需要在终端中通过一个简单的
python
调用来获取REPL shell。