我尝试从以下位置安装python-igraph:
pip install python-igraph
和
[https://github.com/igraph/python-igraph] python setup.py build
两者都报告了与此错误相同的错误: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
任何人都可以帮助我吗?
答案 0 :(得分:2)
您在/usr/local
中安装了igraph的C核心副本,但这与您尝试安装的Python接口版本不兼容。从输出结果来看,您正在安装python-igraph 0.7.1-4
,它与igraph 0.7.1兼容。因此,要么安装igraph的C核,版本0.7.1,要么只删除/usr/local/include/igraph
,/usr/local/lib
和/usr/local/lib/pkgconfig
中所有与igraph相关的内容,然后再次使用{{ 1}}。如果您从计算机中删除了C核,pip install python-igraph
将尝试下载并在编译Python界面时链接到它。