在Windows上,Python 2.6中安装PygraphViz [英] Installing PygraphViz on Windows, Python 2.6

查看:359
本文介绍了在Windows上,Python 2.6中安装PygraphViz的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人在Windows上成功安装PygraphViz?

Anybody out there has successfully installed PygraphViz on Windows?

由于没有为Windows 官方发布,我试图建立它自己,但它失败编译。我不是第一个来的面对这样的问题,但我无法找到答案。

Since there is not an official release for Windows, I'm trying to build it myself, but it fails to compile. I'm not the first one to face this issue, but I could not find an answer.

这是控制台输出:

C:\Python26\Lib\site-packages\pygraphviz-0.99.1>c:\python26\python.exe setup.py
install
library_path=C:/Program Files/Graphviz2.26.3/lib/debug/dll
include_path=C:/Program Files/Graphviz2.26.3/include/graphviz
running install
running build
running build_py
running build_ext
building 'pygraphviz._graphviz' extension
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W
3 /GS- /DNDEBUG "-IC:/Program Files/Graphviz2.26.3/include/graphviz" -Ic:\python
26\include -Ic:\python26\PC /Tcpygraphviz/graphviz_wrap.c /Fobuild\temp.win32-2.
6\Release\pygraphviz/graphviz_wrap.obj
graphviz_wrap.c
warning: I don't know what to do with 'runtime_library_dirs': ['C:/Program Files
/Graphviz2.26.3/lib/debug/dll']
error: don't know how to set runtime library search path for MSVC++

任何帮助将是AP preciated!

Any help would be appreciated!

推荐答案

下面是我在Python 2.7什么工作。我认为它应该在Python 2.6类似的工作。
precondition:安装的mingw32(如果你使用它包含在pythonxy DISTRIB),Graphviz的

Here's what worked for me in Python 2.7. I assume it should work similarly in Python 2.6. Precondition: Install mingw32 (included in pythonxy distrib if you're using it), Graphviz

1)下载pygraphviz源

1) Download pygraphviz sources

2)编辑setup.py改变路径SMTH像

2) Edit setup.py to change paths to smth like

library_path=r"c:\Program Files (x86)\Graphviz 2.28\bin"
include_path=r"c:\Program Files (x86)\Graphviz 2.28\include\graphviz"

请注意,它是\\ bin中,而不是\\ lib中。与库链接并没有为我工作。

Note that it's \bin, not \lib. Linking with libs didn't work for me.

3)运行蟒蛇的setup.py建立-c的mingw32

步骤3的结果:

c:\Python27\Lib\site-packages\pygraphviz-1.1>python setup.py build -c mingw32
library_path=c:\Program Files (x86)\Graphviz 2.28\bin
include_path=c:\Program Files (x86)\Graphviz 2.28\include\graphviz
running build
running build_py
running build_ext
building 'pygraphviz._graphviz' extension
C:\MinGW32-xy\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-Ic:\Program Files (x86)\G
raphviz 2.28\include\graphviz" -Ic:\Python27\include -Ic:\Python27\PC -c pygraph
viz/graphviz_wrap.c -o build\temp.win32-2.7\Release\pygraphviz\graphviz_wrap.o
pygraphviz/graphviz_wrap.c: In function 'agattr_label':
pygraphviz/graphviz_wrap.c:2855:5: warning: return makes integer from pointer wi
thout a cast
writing build\temp.win32-2.7\Release\pygraphviz\_graphviz.def
C:\MinGW32-xy\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.7\Release\py
graphviz\graphviz_wrap.o build\temp.win32-2.7\Release\pygraphviz\_graphviz.def "
-Lc:\Program Files (x86)\Graphviz 2.28\bin" -Lc:\Python27\libs -Lc:\Python27\PCb
uild "-Wl,-Rc:\Program Files (x86)\Graphviz 2.28\bin" -lcgraph -lcdt -lpython27
-lmsvcr90 -o build\lib.win32-2.7\pygraphviz\_graphviz.pyd

4)复制结果,从刚建成lib.win32-2.7(称为单子文件夹 pygraphviz )到您的Python的site-packages文件夹

4) copy the result from the just built lib.win32-2.7 (single sub-folder called pygraphviz) into your Python's site-packages folder

享受!

这篇关于在Windows上,Python 2.6中安装PygraphViz的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆