我执行了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>
有人可以帮忙吗? 非常感谢
答案 0 :(得分:3)
请注意,此帖子假设您已安装homebrew并尝试在Mac上安装。
为了避免python3 / python2的任何问题,我建议使用python2,因为这就是igraph库的设计目的。我在mac上执行了以下代码,工作正常。
在python2上安装igraph的说明,在终端中执行以下行:
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# Set up your driver here....
try:
element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, 'li_myaccount'))
)
element.click()
except:
#Handle any exceptions here
finally:
driver.quit()
现在,这行的最后一行安装了C-core。最终终点线是:
brew install cairo
brew install py2cairo
brew install igraph
以上行为 python2 安装igraph, 请注意,这些行大约需要2分钟才能完成
接下来打开python2或idle-from终端(我使用空闲)。
检查python REPL shell ......
sudo pip install python-igraph
如果一切正常,那么你在python中为你工作了igraph
同时检查一下:
import igraph.test
igraph.test.run_tests()
你应该得到一个很好的peterson图形图形(红色节点,小图形)