Here is my steps:
- Install ActivePython Community Edition (http://www.activestate.com/activepython) in order to have easy_install. Add PYTHON_HOME/Scripts folder to PATH variable.
- Install required/wanted Python packages with easy_install. However, pygraphviz do not have a Windows build, and it can not be easy installed, since Python does not know where Graphviz is installed..
- Install Graphviz (http://www.graphviz.org/)
- Installed an old version of MinGW (specifically the build on 20100831) (http://www.mingw.org/) . Add MinGW/bin to PATH.
- Download pygraphviz (http://networkx.lanl.gov/pygraphviz/) and extract it.
- Edit setup.py of pygraphviz as follows: (they are None as default..)
library_path="C:/Graphviz 2.28/lib/release/lib"
include_path="C:/Graphviz 2.28/include/graphviz"
- Modify line 285 (most probably) from “C:\python27\lib\distutils\unixcompiler.py" as follows:
- old:
compiler = os.path.basename(sysconfig.get_config_var("CC"))
- new:
compiler = "gcc"
- Run the following command from pygraphviz-$version folder:
python setup.py build -c mingw32
- Copy the pygraphviz folder under (some place like) C:\pygraphviz-1.1\build\lib.win32-2.7 to Python site-packages.My site-packages location is C:\Python27\Lib\site-packages.
After the steps above,
import pygraphviz
should succeed on Python interpreter..
Hi,
YanıtlaSilI could not find the MinGW build 20100831 from the link. I installed the latest version of MinGW, and follow all the steps and failed.
the error message was:
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-IC:\Program Files\Graphviz 2.28\include\graphviz"
-Ic:\Python27\include -Ic:\Python27\PC -c pygraphviz/graphviz_wrap.c -o build\temp.win32-2.7\Release
\pygraphviz\graphviz_wrap.o
cc1.exe: error: unrecognized command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1
May you please direct me to the link which I could download the build?
thanks
-John
this link seems alive:
YanıtlaSilhttp://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/mingw-get-inst-20100831/
Thanks, this helped greatly.
YanıtlaSilI also had to make this edit in order to build Django UML graphs, because of the spaces in paths in Windows:
agraph.py, line 1249 in _run_prog():
runprog = '"' + runprog + '"'