Here's what worked for me.
Precondition: Install mingw32 (included in pythonxy distrib if you're using it), Graphviz
1) Download pygraphviz sources
2) Edit setup.py to change paths to smth like
library_path=r"c:Program Files (x86)Graphviz 2.28in"
include_path=r"c:Program Files (x86)Graphviz 2.28includegraphviz"
Note that it's in, not lib. Linking with libs didn't work for me.
3) run python setup.py build -c mingw32
Result of step 3:
c:Python27Libsite-packagespygraphviz-1.1>python setup.py build -c mingw32
library_path=c:Program Files (x86)Graphviz 2.28in
include_path=c:Program Files (x86)Graphviz 2.28includegraphviz
running build
running build_py
running build_ext
building 'pygraphviz._graphviz' extension
C:MinGW32-xyingcc.exe -mno-cygwin -mdll -O -Wall "-Ic:Program Files (x86)G
raphviz 2.28includegraphviz" -Ic:Python27include -Ic:Python27PC -c pygraph
viz/graphviz_wrap.c -o buildemp.win32-2.7Releasepygraphvizgraphviz_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 buildemp.win32-2.7Releasepygraphviz\_graphviz.def
C:MinGW32-xyingcc.exe -mno-cygwin -shared -s buildemp.win32-2.7Releasepy
graphvizgraphviz_wrap.o buildemp.win32-2.7Releasepygraphviz\_graphviz.def "
-Lc:Program Files (x86)Graphviz 2.28in" -Lc:Python27libs -Lc:Python27PCb
uild "-Wl,-Rc:Program Files (x86)Graphviz 2.28in" -lcgraph -lcdt -lpython27
-lmsvcr90 -o buildlib.win32-2.7pygraphviz\_graphviz.pyd
4) copy the result from the just built lib.win32-2.7 (single sub-folder called pygraphviz
) into your Python's site-packages folder
Enjoy!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…