2015-02-10 66 views
1

我在64位Linux Mint 16上使用python 2.7,我試圖安裝python-igraph。但是,當我運行sudo pip install python-igraph我得到以下日誌:UnicodeDecodeError安裝時python-igraph

Downloading/unpacking python-igraph 
    Downloading python-igraph-0.7.1-1.tar.gz (375kB): 375kB downloaded 
    Running setup.py egg_info for package python-igraph 

Installing collected packages: python-igraph 
    Running setup.py install for python-igraph 
    Build type: dynamic extension 
    Include path: /usr/include/igraph 
    Library path: 
    Linked dynamic libraries: igraph 
    Linked static libraries: 
    Extra compiler options: 
    Extra linker options: 
    building 'igraph._igraph' extension 
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/igraph -I../../build/include -I../../include -I/usr/local/include/igraph -I/usr/include/igraph -I/usr/include/python2.7 -c src/igraphmodule.c -o build/temp.linux-x86_64-2.7/src/igraphmodule.o 
    In file included from src/igraphmodule.c:30:0: 
    src/convert.h:65:59: error: unknown type name ‘igraph_pagerank_algo_t’ 
    int igraphmodule_PyObject_to_pagerank_algo_t(PyObject *o, igraph_pagerank_algo_t *result); 
                  ^
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/tmp/pip_build_root/python-igraph/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-akm3_O-record/install-record.txt --single-version-externally-managed: 
    running install 

running build 

running build_py 

creating build 

creating build/lib.linux-x86_64-2.7 

creating build/lib.linux-x86_64-2.7/igraph 

copying igraph/formula.py -> build/lib.linux-x86_64-2.7/igraph 

copying igraph/__init__.py -> build/lib.linux-x86_64-2.7/igraph 

copying igraph/configuration.py -> build/lib.linux-x86_64-2.7/igraph 

copying igraph/summary.py -> build/lib.linux-x86_64-2.7/igraph 

copying igraph/layout.py -> build/lib.linux-x86_64-2.7/igraph 

copying igraph/cut.py -> build/lib.linux-x86_64-2.7/igraph 

copying igraph/datatypes.py -> build/lib.linux-x86_64-2.7/igraph 

copying igraph/utils.py -> build/lib.linux-x86_64-2.7/igraph 

copying igraph/clustering.py -> build/lib.linux-x86_64-2.7/igraph 

copying igraph/statistics.py -> build/lib.linux-x86_64-2.7/igraph 

copying igraph/matching.py -> build/lib.linux-x86_64-2.7/igraph 

copying igraph/compat.py -> build/lib.linux-x86_64-2.7/igraph 

creating build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/operators.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/isomorphism.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/__init__.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/colortests.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/conversion.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/homepage.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/attributes.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/vertexseq.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/structural.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/separators.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/atlas.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/layouts.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/rng.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/games.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/utils.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/iterators.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/edgeseq.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/indexing.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/spectral.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/cliques.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/flow.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/basic.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/generators.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/matching.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/foreign.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/bipartite.py -> build/lib.linux-x86_64-2.7/igraph/test 

copying igraph/test/decomposition.py -> build/lib.linux-x86_64-2.7/igraph/test 

creating build/lib.linux-x86_64-2.7/igraph/app 

copying igraph/app/__init__.py -> build/lib.linux-x86_64-2.7/igraph/app 

copying igraph/app/shell.py -> build/lib.linux-x86_64-2.7/igraph/app 

creating build/lib.linux-x86_64-2.7/igraph/drawing 

copying igraph/drawing/__init__.py -> build/lib.linux-x86_64-2.7/igraph/drawing 

copying igraph/drawing/edge.py -> build/lib.linux-x86_64-2.7/igraph/drawing 

copying igraph/drawing/shapes.py -> build/lib.linux-x86_64-2.7/igraph/drawing 

copying igraph/drawing/coord.py -> build/lib.linux-x86_64-2.7/igraph/drawing 

copying igraph/drawing/metamagic.py -> build/lib.linux-x86_64-2.7/igraph/drawing 

copying igraph/drawing/utils.py -> build/lib.linux-x86_64-2.7/igraph/drawing 

copying igraph/drawing/text.py -> build/lib.linux-x86_64-2.7/igraph/drawing 

copying igraph/drawing/graph.py -> build/lib.linux-x86_64-2.7/igraph/drawing 

copying igraph/drawing/colors.py -> build/lib.linux-x86_64-2.7/igraph/drawing 

copying igraph/drawing/vertex.py -> build/lib.linux-x86_64-2.7/igraph/drawing 

copying igraph/drawing/baseclasses.py -> build/lib.linux-x86_64-2.7/igraph/drawing 

creating build/lib.linux-x86_64-2.7/igraph/remote 

copying igraph/remote/__init__.py -> build/lib.linux-x86_64-2.7/igraph/remote 

copying igraph/remote/nexus.py -> build/lib.linux-x86_64-2.7/igraph/remote 

copying igraph/remote/gephi.py -> build/lib.linux-x86_64-2.7/igraph/remote 

creating build/lib.linux-x86_64-2.7/igraph/vendor 

copying igraph/vendor/__init__.py -> build/lib.linux-x86_64-2.7/igraph/vendor 

copying igraph/vendor/texttable.py -> build/lib.linux-x86_64-2.7/igraph/vendor 

running build_ext 

Build type: dynamic extension 

Include path: /usr/include/igraph 

Library path: 

Linked dynamic libraries: igraph 

Linked static libraries: 

Extra compiler options: 

Extra linker options: 

building 'igraph._igraph' extension 

creating build/temp.linux-x86_64-2.7 

creating build/temp.linux-x86_64-2.7/src 

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/igraph -I../../build/include -I../../include -I/usr/local/include/igraph -I/usr/include/igraph -I/usr/include/python2.7 -c src/igraphmodule.c -o build/temp.linux-x86_64-2.7/src/igraphmodule.o 

In file included from src/igraphmodule.c:30:0: 

src/convert.h:65:59: error: unknown type name ‘igraph_pagerank_algo_t’ 

int igraphmodule_PyObject_to_pagerank_algo_t(PyObject *o, igraph_pagerank_algo_t *result); 

                 ^

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 

---------------------------------------- 
Cleaning up... 
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip_build_root/python-igraph/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-akm3_O-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip_build_root/python-igraph 
Traceback (most recent call last): 
    File "/usr/bin/pip", line 9, in <module> 
    load_entry_point('pip==1.4.1', 'console_scripts', 'pip')() 
    File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 148, in main 
    return command.main(args[1:], options) 
    File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 169, in main 
    text = '\n'.join(complete_log) 
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 50: ordinal not in range(128) 

我以前安裝libigraph0-dev的。我如何在這種情況下安裝python-igraph?

回答

2

libigraph0-dev的版本是否與Python接口的版本號相匹配?如果libigraph0-dev的版本不等於0.7.1,則它將不適用於您試圖編譯的版本python-igraph。在這種情況下,最好刪除libigraph0libigraph0-dev並再次運行pip install python-igraph;安裝腳本將嘗試首先下載並編譯適當版本的igraph C核。

我知道您今天發佈了另一個問題,其中您指出pip install python-igraph(沒有libigraph0-dev)不適用於您;無論如何再試一次,因爲python-igraph的前一個版本有一個錯誤,導致它無法下載正確版本的C核心,並且我在一個小時前修復了這個錯誤。使用下面的代碼的igraph in C

+0

去除libigraph0後安裝python的igraph,我再次點子跑,並輸出與終止巨大的日誌一個錯誤。這個日誌的結尾:'不能下載和編譯igraph的C核。警告:我們無法檢測到您的計算機上安裝了igraph的位置(如果它安裝的話)。我們將使用回退庫,並在setup.py中包含硬編碼的pathss,並希望在那裏安裝igraph的C核。'... src/igraphmodule.c:25:20:致命錯誤:igraph.h:沒有這樣的文件或目錄#include 編譯終止。錯誤:命令'x86_64-linux-gnu-gcc'失敗,退出狀態1' ' – 2015-02-11 06:18:44

+0

任何幫助嗎? – 2015-02-12 10:32:57

+0

它適用於我,所以請發佈完整的編譯日誌,所以我可以看看它。 – 2015-02-12 15:43:20

0

下載源代碼,並安裝它

./configure && make && sudo make install 

然後使用PIP或從源