我正在尝试圖形模型在 Snow Leopard 上工作(来自 django-command 扩展)。它需要 pygraphviz,我通过 macports 安装了它。成功安装后,我收到此错误:
>>> import pygrahphviz
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pygrahphviz
>>> import pygraphviz
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.6/site-packages/pygraphviz-1.1-py2.6-macosx-10.6-universal.egg/pygraphviz/__init__.py", line 54, in <module>
from agraph import AGraph, Node, Edge, Attribute, ItemAttribute
File "/Library/Python/2.6/site-packages/pygraphviz-1.1-py2.6-macosx-10.6-universal.egg/pygraphviz/agraph.py", line 19, in <module>
import graphviz as gv
File "/Library/Python/2.6/site-packages/pygraphviz-1.1-py2.6-macosx-10.6-universal.egg/pygraphviz/graphviz.py", line 7, in <module>
import _graphviz
ImportError: dlopen(/Library/Python/2.6/site-packages/pygraphviz-1.1-py2.6-macosx-10.6-universal.egg/pygraphviz/_graphviz.so, 2): Symbol not found: _Agdirected
Referenced from: /Library/Python/2.6/site-packages/pygraphviz-1.1-py2.6-macosx-10.6-universal.egg/pygraphviz/_graphviz.so
Expected in: flat namespace
in /Library/Python/2.6/site-packages/pygraphviz-1.1-py2.6-macosx-10.6-universal.egg/pygraphviz/_graphviz.so
>>>
有什么建议么?
答案1
您正在使用 Apple 提供的 python,而不是通过 macports 安装的 python
用于sudo port select python ,python-version>
将正确的 python 链接放入 /opt/local/bin/python 中