I can't install pygraphviz on Windows XP. I'm using Python27.
Before to launch the setup I've changet these two variables of the setup.py file
library_path="C:\\Archivos de programa\\Graphviz 2.28\\bin"
include_path="C:\\Archivos de programa\\Graphviz 2.28\\include\\graphviz"
Then I've launched the setup. I'm using mingw32 as a compiler. I don't know what can I do now. I'm using the following command:
C:\Python27\pygraphviz-1.1>c:\python27\python setup.py build -c mingw32
And I've got the folling result
library_path=C:\Archivos de programa\Graphviz 2.28\bin
include_path=C:\Archivos de programa\Graphviz 2.28\include\graphviz
running build
running build_py
running build_ext
building 'pygraphviz._graphviz' extension
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-IC:\Archivos de programa\Graphviz 2.28\include\graphviz" -Ic:\python27\include -Ic:\python
27\PC -c pygraphviz/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 without a cast
writing build\temp.win32-2.7\Release\pygraphviz\_graphviz.def
Traceback (most recent call last):
File "setup.py", line 146, in <module>
package_data = package_data
File "c:\python27\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "c:\python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "c:\python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "c:\python27\lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name)
File "c:\python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "c:\python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "c:\python27\lib\distutils\command\build_ext.py", line 340, in run
self.build_extensions()
File "c:\python27\lib\distutils\command\build_ext.py", line 449, in build_extensions
self.build_extension(ext)
File "c:\python27\lib\distutils\command\build_ext.py", line 531, in build_extension
target_lang=language)
File "c:\python27\lib\distutils\ccompiler.py", line 741, in link_shared_object
extra_preargs, extra_postargs, build_temp, target_lang)
File "c:\python27\lib\distutils\cygwinccompiler.py", line 260, in link
target_lang)
File "c:\python27\lib\distutils\unixccompiler.py", line 218, in link
libraries)
File "c:\python27\lib\distutils\ccompiler.py", line 1121, in gen_lib_options
opt = compiler.runtime_library_dir_option(dir)
File "c:\python27\lib\distutils\unixccompiler.py", line 285, in runtime_library_dir_option
compiler = os.path.basename(sysconfig.get_config_var("CC"))
File "c:\python27\lib\ntpath.py", line 198, in basename
return split(p)[1]
File "c:\python27\lib\ntpath.py", line 170, in split
d, p = splitdrive(p)
File "c:\python27\lib\ntpath.py", line 125, in splitdrive
if p[1:2] == ':':
TypeError: 'NoneType' object is not subscriptable
Any idea on how to solve it over windows?
In other computer with Ubuntu I've installed without problems.
The error is due to a bug in Python distutils library. Edit your "C:\Python27\lib\distutils\unixccompiler.py" file (line 285, in runtime_library_dir_option) and change
compiler = os.path.basename(sysconfig.get_config_var("CC"))
to
compiler = 'gcc'
Don't forget to change it back after you've managed to install pygraphviz :)
来源:https://stackoverflow.com/questions/8224817/installing-pygraphviz-on-windows-python-2-7