纪念一下装了一天终于成功了的 pygraphviz

老师给了我们一个python文件让我们看懂,然后里面有一句

import pygraphviz as pgv为了能让程序在自己的电脑上,跑起来,我像往常一样,用pip install pygraphviz 来安装,然后,另人苦逼的是各种报错哇。然后在github 下载了包(https://github.com/pygraphviz),解压后用python setup.py install 报错,内容为 fatal error: graphviz/cgraph.h: No such file然后在stackoverflow 上找到的解决办法是编辑setup.py文件中添加这些位置作为目录  :

include_dirs = ‘C:/Program Files (x86)/Graphviz2.38/include‘ library_dirs = ‘C:/Program Files (x86)/Graphviz2.38/lib‘

同时我在readme里面看到,这个需要和Graphviz软件一起使用,而我并没有下载,好滴吧,先到官网上下载了Graphviz-2.38
并且添加了目录再次 install

然后错误变得更多了:
$ python setup.py install
library_dirs=C:/Program Files (x86)/Graphviz2.38/lib/release/lib
include_dirs=C:/Program Files (x86)/Graphviz2.38/include
running install
running bdist_egg
running egg_info
writing pygraphviz.egg-info\PKG-INFO
writing top-level names to pygraphviz.egg-info\top_level.txt
writing dependency_links to pygraphviz.egg-info\dependency_links.txt
reading manifest file ‘pygraphviz.egg-info\SOURCES.txt‘
reading manifest template ‘MANIFEST.in‘
warning: no previously-included files matching ‘*~‘ found anywhere in distribution
warning: no previously-included files matching ‘*.pyc‘ found anywhere in distribution
warning: no previously-included files matching ‘.svn‘ found anywhere in distribution
no previously-included directories found matching ‘doc\build‘
writing manifest file ‘pygraphviz.egg-info\SOURCES.txt‘
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
building ‘pygraphviz._graphviz‘ extension
C:\Users\GJWood\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD
 /W3 /GS- /DNDEBUG -DGVDLL "-IC:/Program Files (x86)/Graphviz2.38/include" -Ic:\Users\GJWood\Anaconda\include -Ic:\Users
\GJWood\Anaconda\PC /Tcpygraphviz/graphviz_wrap.c /Fobuild\temp.win-amd64-2.7\Release\pygraphviz/graphviz_wrap.obj
graphviz_wrap.c
pygraphviz/graphviz_wrap.c(3295) : warning C4267: ‘=‘ : conversion from ‘size_t‘ to ‘int‘, possible loss of data
pygraphviz/graphviz_wrap.c(3313) : warning C4267: ‘=‘ : conversion from ‘size_t‘ to ‘int‘, possible loss of data
pygraphviz/graphviz_wrap.c(3321) : warning C4047: ‘return‘ : ‘int‘ differs in levels of indirection from ‘Agsym_t *‘
pygraphviz/graphviz_wrap.c(3407) : warning C4101: ‘mode_byte_obj1‘ : unreferenced local variable
pygraphviz/graphviz_wrap.c(3406) : warning C4101: ‘mode_obj1‘ : unreferenced local variable
pygraphviz/graphviz_wrap.c(3408) : warning C4101: ‘mode1‘ : unreferenced local variable
pygraphviz/graphviz_wrap.c(3405) : warning C4101: ‘fd1‘ : unreferenced local variable
pygraphviz/graphviz_wrap.c(3466) : warning C4101: ‘mode2‘ : unreferenced local variable
pygraphviz/graphviz_wrap.c(3464) : warning C4101: ‘mode_obj2‘ : unreferenced local variable
pygraphviz/graphviz_wrap.c(3463) : warning C4101: ‘fd2‘ : unreferenced local variable
pygraphviz/graphviz_wrap.c(3465) : warning C4101: ‘mode_byte_obj2‘ : unreferenced local variable
C:\Users\GJWood\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /IN
CREMENTAL:NO "/LIBPATH:C:/Program Files (x86)/Graphviz2.38/lib/release/lib" /LIBPATH:c:\Users\GJWood\Anaconda\libs /LIBP
ATH:c:\Users\GJWood\Anaconda\PCbuild\amd64 cgraph.lib cdt.lib /EXPORT:init_graphviz build\temp.win-amd64-2.7\Release\pyg
raphviz/graphviz_wrap.obj /OUT:build\lib.win-amd64-2.7\pygraphviz\_graphviz.pyd /IMPLIB:build\temp.win-amd64-2.7\Release
\pygraphviz\_graphviz.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\pygraphviz\_graphviz.pyd.manifest
graphviz_wrap.obj : warning LNK4197: export ‘init_graphviz‘ specified multiple times; using first specification
   Creating library build\temp.win-amd64-2.7\Release\pygraphviz\_graphviz.lib and object build\temp.win-amd64-2.7\Releas
e\pygraphviz\_graphviz.exp
graphviz_wrap.obj : error LNK2019: unresolved external symbol agsafeset referenced in function agsafeset_label
graphviz_wrap.obj : error LNK2019: unresolved external symbol agstrdup_html referenced in function agsafeset_label
graphviz_wrap.obj : error LNK2019: unresolved external symbol agattr referenced in function agattr_label
graphviz_wrap.obj : error LNK2019: unresolved external symbol agopen referenced in function _wrap_agopen
graphviz_wrap.obj : error LNK2019: unresolved external symbol agclose referenced in function _wrap_agclose
graphviz_wrap.obj : error LNK2019: unresolved external symbol agread referenced in function _wrap_agread
graphviz_wrap.obj : error LNK2019: unresolved external symbol agwrite referenced in function _wrap_agwrite
graphviz_wrap.obj : error LNK2019: unresolved external symbol agisundirected referenced in function _wrap_agisundirected

graphviz_wrap.obj : error LNK2019: unresolved external symbol agisdirected referenced in function _wrap_agisdirected
graphviz_wrap.obj : error LNK2019: unresolved external symbol agisstrict referenced in function _wrap_agisstrict
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnode referenced in function _wrap_agnode
graphviz_wrap.obj : error LNK2019: unresolved external symbol agidnode referenced in function _wrap_agidnode
graphviz_wrap.obj : error LNK2019: unresolved external symbol agsubnode referenced in function _wrap_agsubnode
graphviz_wrap.obj : error LNK2019: unresolved external symbol agfstnode referenced in function _wrap_agfstnode
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnxtnode referenced in function _wrap_agnxtnode
graphviz_wrap.obj : error LNK2019: unresolved external symbol aglstnode referenced in function _wrap_aglstnode
graphviz_wrap.obj : error LNK2019: unresolved external symbol agprvnode referenced in function _wrap_agprvnode
graphviz_wrap.obj : error LNK2019: unresolved external symbol agedge referenced in function _wrap_agedge
graphviz_wrap.obj : error LNK2019: unresolved external symbol agidedge referenced in function _wrap_agidedge
graphviz_wrap.obj : error LNK2019: unresolved external symbol agsubedge referenced in function _wrap_agsubedge
graphviz_wrap.obj : error LNK2019: unresolved external symbol agfstin referenced in function _wrap_agfstin
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnxtin referenced in function _wrap_agnxtin
graphviz_wrap.obj : error LNK2019: unresolved external symbol agfstout referenced in function _wrap_agfstout
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnxtout referenced in function _wrap_agnxtout
graphviz_wrap.obj : error LNK2019: unresolved external symbol agfstedge referenced in function _wrap_agfstedge
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnxtedge referenced in function _wrap_agnxtedge
graphviz_wrap.obj : error LNK2019: unresolved external symbol agattrsym referenced in function _wrap_agattrsym
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnxtattr referenced in function _wrap_agnxtattr
graphviz_wrap.obj : error LNK2019: unresolved external symbol agget referenced in function _wrap_agget
graphviz_wrap.obj : error LNK2019: unresolved external symbol agxget referenced in function _wrap_agxget
graphviz_wrap.obj : error LNK2019: unresolved external symbol agset referenced in function _wrap_agset
graphviz_wrap.obj : error LNK2019: unresolved external symbol agxset referenced in function _wrap_agxset
graphviz_wrap.obj : error LNK2019: unresolved external symbol agsubg referenced in function _wrap_agsubg
graphviz_wrap.obj : error LNK2019: unresolved external symbol agfstsubg referenced in function _wrap_agfstsubg
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnxtsubg referenced in function _wrap_agnxtsubg
graphviz_wrap.obj : error LNK2019: unresolved external symbol agparent referenced in function _wrap_agparent
graphviz_wrap.obj : error LNK2019: unresolved external symbol agroot referenced in function _wrap_agroot
graphviz_wrap.obj : error LNK2019: unresolved external symbol agdelsubg referenced in function _wrap_agdelsubg
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnnodes referenced in function _wrap_agnnodes
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnedges referenced in function _wrap_agnedges
graphviz_wrap.obj : error LNK2019: unresolved external symbol agdegree referenced in function _wrap_agdegree
graphviz_wrap.obj : error LNK2019: unresolved external symbol agraphof referenced in function _wrap_agraphof
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnameof referenced in function _wrap_agnameof
graphviz_wrap.obj : error LNK2019: unresolved external symbol agdelnode referenced in function _wrap_agdelnode
graphviz_wrap.obj : error LNK2019: unresolved external symbol agdeledge referenced in function _wrap_agdeledge
graphviz_wrap.obj : error LNK2019: unresolved external symbol Agdirected referenced in function Swig_var_Agdirected_get
graphviz_wrap.obj : error LNK2019: unresolved external symbol Agstrictdirected referenced in function Swig_var_Agstrictd
irected_get
graphviz_wrap.obj : error LNK2019: unresolved external symbol Agundirected referenced in function Swig_var_Agundirected_
get
graphviz_wrap.obj : error LNK2019: unresolved external symbol Agstrictundirected referenced in function Swig_var_Agstric
tundirected_get
build\lib.win-amd64-2.7\pygraphviz\_graphviz.pyd : fatal error LNK1120: 49 unresolved externals
error: command ‘C:\\Users\\GJWood\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd
64\\link.exe‘ failed with exit status 1120
 
这时候我才想起,可以到http://www.lfd.uci.edu/~gohlke/pythonlibs/直接下载.whl文件哇。下载并安装 
pip install pygraphviz?1.3.1?cp27?none?win_amd64.whl

成功啦

然而这并没有结束

当我试着打了如下代码,并运行时:

import pygraphviz as pgv
G=pgv.AGraph(strict=False,directed=True)

G.add_node(‘a‘)
G.add_node(‘b‘)
G.add_edge(‘b‘,‘c‘)

nodelist=[‘f‘,‘g‘,‘h‘]
G.add_nodes_from(nodelist)

#attributes
G.graph_attr[‘label‘]="simple nodes and edge"
G.node_attr[‘shape‘]=‘circle‘
G.edge_attr[‘color‘]=‘red‘

s=G.to_string()

G.write("first.dot")

G.layout(prog=‘dot‘)

G.draw(‘first.png‘)

它依旧报错

Traceback (most recent call last):
  File "D:\Program Files\Eclipse\plugins\org.python.pydev_3.3.3.201401272249\pysrc\pydevd.py", line 1738, in <module>
    debugger.run(setup[‘file‘], None, None)
  File "D:\Program Files\Eclipse\plugins\org.python.pydev_3.3.3.201401272249\pysrc\pydevd.py", line 1355, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "D:\Users\SUUSER\workspace\ThreadGraph\parseText.py", line 17, in <module>
    G.layout(prog=‘dot‘)
  File "C:\Python27\lib\site-packages\pygraphviz\agraph.py", line 1305, in layout
    data=self._run_prog(prog,‘ ‘.join([args,"-T",fmt]))
  File "C:\Python27\lib\site-packages\pygraphviz\agraph.py", line 1251, in _run_prog
    runprog=r‘"%s"‘%self._get_prog(prog)
  File "C:\Python27\lib\site-packages\pygraphviz\agraph.py", line 1239, in _get_prog
    raise ValueError("Program %s not found in path."%prog)
ValueError: Program dot not found in path.

查到的资料说“PyGraphviz doesn‘t work without Graphviz. Install that too.”(http://stackoverflow.com/questions/13987353/python-valueerror-program-dot-not-found-in-path?rq=1)

可是我已经装了呀。这是才想起来,是不是还要设置环境变量什么的:我又把C:\Program Files (x86)\Graphviz2.38\bin加到PATH里去

关了pycharm,重开,运行,OK,不报错了

最后的最后,放出相关下载链接

graphviz-2.38.msi链接:http://pan.baidu.com/s/1nu4wcgp 密码:zazz
pygraphviz?1.3.1?cp27?none?win_amd64.whl链接:http://pan.baidu.com/s/1c1nJyKg 密码:wra9
时间: 2024-10-28 22:39:58

纪念一下装了一天终于成功了的 pygraphviz的相关文章

终于成功仿了一次Kalman滤波器

终于成功仿了一次Kalman滤波器 首先是测试了从网上down的一段代码 % KALMANF - updates a system state vector estimate based upon an% observation, using a discrete Kalman filter.%% Version 1.0, June 30, 2004%% This tutorial function was written by Michael C. Kleder% (Comments are 

终于成功配置 nginx + proxy

今天晚上折腾两个小时,终于成功配置 nginx + proxy 支持以下访问地址,使用的是同一个Flask APP. https://search.readmorejoy.com/ https://markdown.readmorejoy.com/ 初次的学习总是比较折磨人. 单独出 markdown,是因为还要出一个 PC版本 原文地址:https://www.cnblogs.com/pycoding/p/11360979.html

win10安装.net framework3.5,终于成功了

装了win10发现需要运行很多程序时还需要安装.net framework3.5,然后从网上找了好多方法,要么太慢,要么行不通,不过最后终于找到了一个正解方法.. 第一步,挂载或插入安装光盘.在sources\sxs文件夹中会有一个“microsoft-windows-netfx3-ondemand-package.cab”文件.Win+X,以管理员权限启动命令提示符.假设安装盘盘符为X.首先运行:dism.exe /online /add-package /packagepath:X:\sou

我的天,终于成功了

随着电脑重装系统的完成,我好像拥有了一台崭新的电脑一般,幸福o(* ̄▽ ̄*)o!然后就开始风风火火在上面部署自己的“数据科学家”学习环境.过程如下: -R -RStudio -Sublime Text -Java -Scala 后来想弄一个spark的学习环境,在dos受挫后于是又装了: -Scala IDE(eclipse) 然后就开始捣鼓.有了Scala IDE 跟spark还没关系啊,准备弄成spark本地单机模式. 最初下的是spark源码,由于sbt下不来,又重新去下了spark 二进

折腾了好久的macos+apache+php+phpmyadmin 终于成功了!

由于最近需要布置mantis用来进行bug追踪,在此记录其过程. 由于PHP apache环境在Mac OS上是自带的,所以不需要另处下安装包,只需要简单配置一下即可. 首先打开终端输入命令: sudo vim /etc/apache2/httpd.conf 其中有一行是这样的 #LoadModule php5_module libexec/apache2/libphp5.so 将前面的#号去掉. 然后打开系统偏好设置中的共享,将web共享勾上,如下图 重启apache, 命令如下: sudo

终于成功编译并且运行了 android源代码 总结一下 遇到的 问题

android 源代码编译真是 好难呀 ,几个月前我曾经编译过但遇到了各种问题,可能是采用ubuntu12.04的原因,这次下载和编译都很顺利.ubuntu采用14.04 在下载前提前进行了hosts设置,我是吧http://laod.cn/hosts/2015-google-hosts.html 这哥们的 hosts整个粘贴到/etc/hosts 文件中的,采用学校校园网下载,不知道用其他网会不会 出问题,上次下载各种 不能访问. 编译的时候也很顺利,直接编译出来了,我 觉得与系统版本有很大关

android studio1.3安装终于成功

本人机器是win7 32位旗舰版,4G内存.以前使用eclipse adt bundle开发Android程序感觉非常方便,但随着google对andriod studio支持力度加大,转向studio似是大势所趋,遂决定安装安装最新版的andriod studio 1.3试用一下. 1, 不成功的经历 先是在http://www.android-studio.org/上下载了完整版的windows安装包android-studio-bundle-141.1980579-windows.exe,

品Spring:注解终于“成功上位”

历史还是抛弃了XML,当它逐渐尝到注解的甜头之后. 尤其是在Spring帝国,到处充满着注解的气息. 注解从一个提供附属信息的“门客”,蜕变为颇具中流砥柱的“君侯”. 注解成功登上了帝国的舞台,定会像XML一样留下浓墨重彩的一笔. 重新认识一下注解 注解其实就是注释.批注的意思.就像看书时在旁边记笔记一样. 如果把书上印刷的内容看作是原始信息,那写上的笔记则是新添加的额外信息,且这个额外信息并不会对原始信息造成破坏. 所以注解其实是为原始数据信息添加额外附加数据信息的一种方式,且对原有数据信息没

刚刚完成了在vs2013中通过 ef连接mysql数据库的工作。感觉没有想象中的简单。试了n次终于成功。故记录成功的方法,希望可以帮到大家

分两种情况,如果你是用entity framework 5.0的时候 mysql-connector-net的版本不是很重要. MySQL For VisualStudio的版本也不重要 (这个不装就不能选择连mysql) 如果你是要用entity framework 6.0的时候就麻烦点了,mysql-connector-net用最新的mysql-connector-net 6.9.6(下载地址:http://cdn.mysql.com/Downloads/Connector-Net/mysq