2016-12-28 76 views
0

我曾嘗試使用pip install安裝python-igraph但得到導入時的錯誤消息:錯誤而在Ubuntu上安裝Python-的igraph 16.04

:~$ pip install python-igraph 
Collecting python-igraph 
Installing collected packages: python-igraph 
Successfully installed python-igraph-0.7.1.post6 
:~$ python 
Python 2.7.12 |Anaconda 4.2.0 (64-bit)| (default, Jul 2 2016, 17:42:40) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
Anaconda is brought to you by Continuum Analytics. 
Please check out: http://continuum.io/thanks and https://anaconda.org 
>>> import igraph 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/home/user/anaconda2/lib/python2.7/site-packages/igraph/__init__.py", line 34, in <module> 
    from igraph._igraph import * 
ImportError: /home/user/anaconda2/lib/python2.7/site-packages/igraph/_igraph.so: undefined symbol: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1Ev 

然後我試圖通過anaconda安裝,這也導致了錯誤:

compilation terminated. 
    error: command 'gcc' failed with exit status 1 

    ---------------------------------------- 
Command "/home/user/anaconda2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-65xDUp/python-igraph/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-LIJjEG-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-65xDUp/python-igraph/ 

完整的錯誤信息在這裏 - link。上次我在Ubuntu上安裝了igraph,沒有像這樣的問題。任何人都遇到過這個並知道如何解決它?

+0

第二個錯誤只顯示了幾行最後一行 - 查看行的其餘部分並搜索是否有關於python.h或其他.h文件的某些內容 - 它接縫無法找到某些文件進行編譯。 – furas

+0

我發現'使用pkg-config無法在此係統上找到igraph的C核。 我們現在嘗試從頭開始下載和編譯C核,然後'無法下載和編譯igraph的C核。可能是什麼原因? – Ohm

+0

你必須顯示所有行。它試圖編譯C代碼,但它有問題。大多數情況下,它需要在文件* .h中包含一些C頭文件,因此您必須安裝一些庫 - 但是它會根據錯誤消息中的信息來確定。 – furas

回答

2

具有相同的問題。 PIP安裝比較冗長,但:

curl: (22) The requested URL returned error: 404 Not Found 
Error: Failed to download resource "igraph" 
Download failed: http://igraph.org/nightly/get/c/igraph-0.7.1.tar.gz 

好像http://igraph.org/nightly不可達。

+1

已打開問題https://github.com/igraph/python-igraph/issues/108 – Blaubaer