本文介绍了pygraphviz,ImportError:未定义的符号:Agundirected的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
import pygraphviz
Traceback(最近一次调用最后一次):
文件< stdin>,第1行,< module>
文件/usr/local/lib/python2.7/dist-packages/pygraphviz/__init__.py,第58行,< module>来自.agraph的
导入AGraph,Node,Edge,Attribute,ItemAttribute,DotError
文件/usr/local/lib/python2.7/dist-packages/pygraphviz/agraph.py,第26行,在< module>中
来自。将graphviz导入为gv
文件/usr/local/lib/python2.7/dist-packages/pygraphviz/graphviz.py,第28行,< module>
_graphviz = swig_import_helper()
文件/usr/local/lib/python2.7/dist-packages/pygraphviz/graphviz.py,第24行,swig_import_helper
_mod = imp。 load_module('_ graphviz',fp,pathname,description)
ImportError:/usr/local/lib/python2.7/dist-packages/pygraphviz/_graphviz.so:undefined symbol:Agundirected
我已经尝试过
pip install pygraphviz --install-option = - include-path = / usr / include / graphviz--install-option = - library-path = / usr / lib / graphviz /
我也试过这个答案,但仍然无法正常工作
pip uninstall pygraphviz
然后检查你的路径:
pkg-config --libs-only-L libcgraph
pkg-config --cflags -only-I libcgraph
该命令应该告诉库的路径,例如:
-I / usr / include / graphviz
然后,使用上面输出的路径,在[virtualenv]中运行命令:
pip install pygraphviz --install-option = - include-path = / usr / include / graphviz--install-option = - library-path = / usr / lib / graphviz /
资料来源:
import pygraphviz
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pygraphviz/__init__.py", line 58, in <module>
from .agraph import AGraph, Node, Edge, Attribute, ItemAttribute, DotError
File "/usr/local/lib/python2.7/dist-packages/pygraphviz/agraph.py", line 26, in <module>
from . import graphviz as gv
File "/usr/local/lib/python2.7/dist-packages/pygraphviz/graphviz.py", line 28, in <module>
_graphviz = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/pygraphviz/graphviz.py", line 24, in swig_import_helper
_mod = imp.load_module('_graphviz', fp, pathname, description)
ImportError: /usr/local/lib/python2.7/dist-packages/pygraphviz/_graphviz.so: undefined symbol: Agundirected
I have already tried
pip install pygraphviz --install-option="--include-path=/usr/include/graphviz" --install-option="--library-path=/usr/lib/graphviz/"
I have also tried this answer but still not working
Python does not see pygraphviz
解决方案
First of all, uninstall your current module:
pip uninstall pygraphviz
then check your paths with:
pkg-config --libs-only-L libcgraph
pkg-config --cflags-only-I libcgraph
That commands should tell the path to the library, for example:
-I/usr/include/graphviz
Then, using the path from the above output, run [within your virtualenv] the command:
pip install pygraphviz --install-option="--include-path=/usr/include/graphviz" --install-option="--library-path=/usr/lib/graphviz/"
Source: https://github.com/pygraphviz/pygraphviz/issues/71
这篇关于pygraphviz,ImportError:未定义的符号:Agundirected的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!