2011-11-22 152 views
3

我無法在Windows XP上安裝pygraphviz。我正在使用Python27。在Windows上安裝PyGraphViz,Python 2.7

前推出我changet的setup.py文件

library_path="C:\\Archivos de programa\\Graphviz 2.28\\bin" 
include_path="C:\\Archivos de programa\\Graphviz 2.28\\include\\graphviz" 

然後我推出了設置這兩個變量的設置。我使用mingw32作爲編譯器。我不知道現在可以做什麼。我使用下面的命令:

C:\Python27\pygraphviz-1.1>c:\python27\python setup.py build -c mingw32 

而且我已經得到了folling結果

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 

如何在窗口內解決任何的想法?

在其他裝有Ubuntu的電腦上,我安裝了沒有問題。

+0

我遵循這些[說明](http://bullogger.wordpress.com/2010/02/12/)並設法在我的機器上安裝pygraphviz。 – Seitaridis

回答

2

錯誤是由於Python distutils庫中的一個錯誤。編輯您的 「C:\ Python27 \ LIB \的distutils \ unixccompiler.py」 文件(行285,在runtime_library_dir_option)和改變

compiler = os.path.basename(sysconfig.get_config_var("CC")) 

compiler = 'gcc' 

不要忘記後改回來你已經設法安裝pygraphviz :)

+0

這不適合我。 – Bobort