我无法在 mac 10.6 上导入 igraph

发布于 2024-11-18 20:15:12 字数 1065 浏览 4 评论 0原文

我在我的 mac 中安装了 python 的 igraph 但无法导入它。首先我安装了 C 核心库,然后我继续安装 python,方法是:

python setup.py build
python setup.py install

一切似乎都工作正常,但我无法从 python shell 导入 igraph。澄清一下,我不在 igraph 源代码的文件夹内。我收到此错误:

import igraph
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.3-fat/egg/igraph/__init__.py", line 30, in <module>

  File "build/bdist.macosx-10.3-fat/egg/igraph/core.py", line 7, in <module>
  File "build/bdist.macosx-10.3-fat/egg/igraph/core.py", line 6, in __bootstrap__
ImportError: dlopen(/Users/*****/.python-eggs/python_igraph-0.5.4-py2.7-macosx-10.3-fat.egg-tmp/igraph/core.so, 2): Symbol not found: _igraph_vector_destroy
  Referenced from: /Users/*****/.python-eggs/python_igraph-0.5.4-py2.7-macosx-10.3-fat.egg-tmp/igraph/core.so
  Expected in: dynamic lookup

我将文件夹名称替换为 *,所以不要考虑它。

我在操作系统 10.6.7 上运行 python 2.7。因此没有可用的 igraph 预编译版本(仅限 2.5 和 2.6)。这个错误和我运行的python版本有关系吗? 如果可以的话,我该如何解决这个问题?

I installed igraph for python in my mac but I can't import it. First I installed C core library, then I proceeded with the instalation for python, by doing:

python setup.py build
python setup.py install

Everything seemed to work fine but I can't import igraph from python shell. Just to clear up, I'm not inside igraph source code's folder. And I got this error:

import igraph
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.3-fat/egg/igraph/__init__.py", line 30, in <module>

  File "build/bdist.macosx-10.3-fat/egg/igraph/core.py", line 7, in <module>
  File "build/bdist.macosx-10.3-fat/egg/igraph/core.py", line 6, in __bootstrap__
ImportError: dlopen(/Users/*****/.python-eggs/python_igraph-0.5.4-py2.7-macosx-10.3-fat.egg-tmp/igraph/core.so, 2): Symbol not found: _igraph_vector_destroy
  Referenced from: /Users/*****/.python-eggs/python_igraph-0.5.4-py2.7-macosx-10.3-fat.egg-tmp/igraph/core.so
  Expected in: dynamic lookup

I replaced my folder's name for *, so don't consider it.

I'm running python 2.7 over OS 10.6.7. So there's no pre-compiled version of igraph avaliable (2.5 and 2.6 only). Has this error anything to do with the python version I'm running?
If possible, how can I work this out?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请爱~陌生人 2024-11-25 20:15:12

我认为问题在于 igraph 安装在 /usr/local/lib/libigraph.dylib 中,但是当 Python 尝试加载 igraph 模块的 C 核心时,链接器找不到它,因为 /usr/local/lib 不在 Mac OS X 中的默认库路径上。(至少我这么认为)。

首先,请检查 libigraph.dylib 是否确实在 /usr/local/lib 中 - 它应该在那里。之后,试试这个:

DYLD_LIBRARY_PATH=/usr/local/lib python -m igraph.test.__init__

这应该指示链接器在 /usr/local/lib 以及默认位置中查找,然后使用整个 igraph 测试套件运行 Python。

I think the problem is that igraph is installed in /usr/local/lib/libigraph.dylib, but the linker cannot find it when Python tries to load the C core of the igraph module because /usr/local/lib is not on the default library path in Mac OS X. (At least I think so).

First, please check whether libigraph.dylib is really in /usr/local/lib - it should be there. After that, try this:

DYLD_LIBRARY_PATH=/usr/local/lib python -m igraph.test.__init__

This should instruct the linker to look around in /usr/local/lib as well as the default places, and then run Python with the entire igraph test suite.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文