我已经安装了Graphviz和PyGraphviz,当我打开cmd并输入以下命令时:
python
import _graphviz
_graphviz可以被导入,但当我运行一个将调用.py文件的C++程序时,这个.py文件中有一行是
import pygraphviz as pgv
然后它将无法导入_graphviz,会显示以下信息:
Traceback (most recent call last):
File "E:\project\graph\analysis\x64\Debug\gengraph.py", line 1, in <module>
import pygraphviz as pgv
File "C:\Program Files\Python27\lib\site-packages\pygraphviz\__init__.py", lin
e 54, in <module>
from agraph import AGraph, Node, Edge, Attribute, ItemAttribute
File "C:\Program Files\Python27\lib\site-packages\pygraphviz\agraph.py", line
20, in <module>
import graphviz as gv
File "C:\Program Files\Python27\lib\site-packages\pygraphviz\graphviz.py", lin
e 7, in <module>
import _graphviz
ImportError: No module named _graphviz
你能帮助我吗?任何建议都受欢迎,谢谢!
python-pygraphviz
解决了这个问题。 - Bretsko