Skip to main content
 首页 » 编程设计

python之在 debian 上安装 Igraph 0.7 时出错

2024年10月25日13rubylouvre

我尝试从以下位置安装 python-igraph:

pip 安装 python-igraph

和

[ https://github.com/igraph/python-igraph] python setup.py 构建

两者都报告了与此错误相同的错误:https://github.com/igraph/igraph/issues/468

在几次尝试失败后,我又遇到了另一个错误:

输入:sudo python setup.py build 或 sudo pip install python-igraph

输出:

/usr/local/lib/python2.7/dist-packages/setuptools-15.0-py2.7.egg/setuptools/dist.py:282: UserWarning: Normalizing '0.7.1-4' to '0.7.1.post4' 
running install 
running bdist_egg 
running egg_info 
creating python_igraph.egg-info 
writing python_igraph.egg-info/PKG-INFO 
writing top-level names to python_igraph.egg-info/top_level.txt 
writing dependency_links to python_igraph.egg-info/dependency_links.txt 
writing python_igraph.egg-info/PKG-INFO 
writing top-level names to python_igraph.egg-info/top_level.txt 
writing dependency_links to python_igraph.egg-info/dependency_links.txt 
writing manifest file 'python_igraph.egg-info/SOURCES.txt' 
reading manifest file 'python_igraph.egg-info/SOURCES.txt' 
reading manifest template 'MANIFEST.in' 
writing manifest file 'python_igraph.egg-info/SOURCES.txt' 
installing library code to build/bdist.linux-x86_64/egg 
running install_lib 
running build_py 
running build_ext 
Build type: dynamic extension 
Include path: /usr/local/include/igraph 
Library path: /usr/local/lib 
Linked dynamic libraries: igraph 
Linked static libraries:  
Extra compiler options:  
Extra linker options:  
building 'igraph._igraph' extension 
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/igraph -I../../build/include -I../../include -I/usr/local/include/igraph -I/usr/include/igraph -I/usr/include/python2.7 -c src/edgeobject.c -o build/temp.linux-x86_64-2.7/src/edgeobject.o 
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/igraph -I../../build/include -I../../include -I/usr/local/include/igraph -I/usr/include/igraph -I/usr/include/python2.7 -c src/random.c -o build/temp.linux-x86_64-2.7/src/random.o 
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/igraph -I../../build/include -I../../include -I/usr/local/include/igraph -I/usr/include/igraph -I/usr/include/python2.7 -c src/bfsiter.c -o build/temp.linux-x86_64-2.7/src/bfsiter.o 
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/igraph -I../../build/include -I../../include -I/usr/local/include/igraph -I/usr/include/igraph -I/usr/include/python2.7 -c src/edgeseqobject.c -o build/temp.linux-x86_64-2.7/src/edgeseqobject.o 
In file included from src/edgeseqobject.c:27:0: 
src/convert.h:63:57: error: unknown type name ‘igraph_layout_grid_t’ 
src/convert.h:66:63: error: unknown type name ‘igraph_random_walk_stuck_t’ 
error: command 'gcc' failed with exit status 1 

谁能帮帮我?

请您参考如下方法:

您在 /usr/local 中安装了 igraph 的 C 核心副本,但它与您尝试安装的 Python 接口(interface)版本不兼容。从输出来看,你正在安装 python-igraph 0.7.1-4,它与 igraph 0.7.1 兼容。因此,要么安装 igraph 的 C 核心版本 0.7.1,要么从 /usr/local/include/igraph, /usr/local/lib 中删除所有与 igraph 相关的东西 和可能的 /usr/local/lib/pkgconfig 然后用 pip install python-igraph 再试一次。如果您从计算机中删除了 C 内核,pip install python-igraph 将在编译 Python 接口(interface)时尝试下载它并链接到它。