【发布时间】:2011-07-07 03:05:52
【问题描述】:
我在我的 mac 中安装了 igraph for python,但我无法导入它。首先我安装了 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
我用 * 替换了我的文件夹名称,所以不要考虑。
我在 OS 10.6.7 上运行 python 2.7。所以没有可用的 igraph 预编译版本(仅限 2.5 和 2.6)。这个错误与我正在运行的 python 版本有什么关系吗? 如果可能,我该如何解决?
【问题讨论】:
-
你在哪里安装了igraph的C核?它是否在链接器可以找到的某个标准位置?您的机器上是否有任何其他安装的核心库(旧版本)可能会混淆链接器?
-
其实我之前没有安装过核心库。我认为 C 核心安装在标准位置,因为我没有指定任何位置。我刚刚做了:
./configure然后make然后make install()。我想在哪里安装它?如果要更改安装位置,如何设置安装C核心的路径以及如何删除安装在错误目录中的路径? (我是mac的初学者,对不起) -
通常的
./configure && make && make installdance应该在/usr/local/lib/libigraph.dylib中安装igraph,应该没问题。你确定你下载编译的igraph内核的版本号和Python接口的版本号一致吗? -
我已经下载并安装了 sourceforge 的最新版本 0.5.4。我的 Python 接口的版本号是 2.7。
标签: macos import python-2.7 igraph