如何在Ubuntu 8.04 LTS 64位上安装python-igraph?

4 投票
4 回答
3530 浏览
提问于 2025-04-15 11:26

显然,libigraphpython-igraph 是在 Ubuntu 8.04 LTS 64位系统上,唯一不能通过 apt-geteasy_install 安装的包。

从源代码安装这两个包似乎一切顺利……直到我尝试使用它们的时候。

当我运行 Python 时,我得到了:

>>> import igraph
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "igraph/__init__.py", line 30, in <module>
    from igraph.core import *
 ImportError: No module named core

或者(如果我使用 easy_install 版本的 python-igraph)

>>> import igraph
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/igraph/__init__.py", line 30, in <module>
  File "build/bdist.linux-x86_64/egg/igraph/core.py", line 7, in <module>
  File "build/bdist.linux-x86_64/egg/igraph/core.py", line 6, in __bootstrap__
ImportError: libigraph.so.0: cannot open shared object file: No such file or directory

我从这里获取了源代码:

igraph 0.5.2 = http://igraph.sourceforge.net/download.html

python-igraph 0.5.2 = http://pypi.python.org/pypi/python-igraph/0.5.2

有没有人能给我指个方向?

4 个回答

0

libigraph.so.0在哪里呢?它好像不在Python常常查找的地方,比如/usr/lib、/usr/local/lib这些文件夹里。

2

请注意,从2009年11月8日起,Ubuntu官方提供了igraph的安装包,可以在Launchpad上找到。你可以查看Launchpad上的相关页面,里面有安装的说明。与之前的Debian软件包库不同,这个安装包应该可以在32位和64位的系统上都正常使用。

11

你是怎么编译的?有没有执行过 make install(如果有的话)。

关于 easy_install 版本的“找不到库”的错误,我建议你试试以下方法:

  1. 执行 'sudo updatedb' (这个命令是用来更新文件数据库的)
  2. 执行 'locate libigraph.so.0' (这个命令可以帮助你找到这个文件在你电脑上的位置。如果你执行过 make install,它可能会被放在 /usr/local/lib 里……或者在 Python 的库目录里?)
  3. 检查一下这个文件所在的目录是否在你当前的 LD_LIBRARY_PATH 里(可以用 'echo $LD_LIBRARY_PATH' 来查看)。
  4. 如果这个目录不在里面,可以添加进去,试试 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/yourdirhere' (如果想让这个设置永久生效,可以把它加到 /etc/ld.so.conf 里)或者用 'ldconfig -n /yourdirhere'。

撰写回答