在Mac OS X 10.9上安装pygraphviz 1.2时出错(丢失库)

时间:2014-09-14 03:32:27

标签: macos installation clang graphviz pygraphviz

我使用的是Mac OS X 10.9。我已经安装了graphviz 2.36.0。

下载pygraphviz 1.2之后,我在setup.py中修改了变量" library_path"和" include_path":

library_path='/usr/local/lib/graphviz'
include_path='/usr/local/include/graphviz' 

当我尝试使用python setup.py install安装graphviz时,收到以下消息:

library_path=/usr/local/lib/graphviz
include_path=/usr/local/include/graphviz
running install
running build
running build_py
running build_ext
building 'pygraphviz._graphviz' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/usr/local/include/graphviz -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.9-intel-2.7/pygraphviz/graphviz_wrap.o
pygraphviz/graphviz_wrap.c:2040:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
                    res = SWIG_AddCast(res);
                    ~~~ ^              ~~~
pygraphviz/graphviz_wrap.c:2043:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
                    res = SWIG_AddCast(res);                
                    ~~~ ^              ~~~
pygraphviz/graphviz_wrap.c:2829:15: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
        len = strlen(val);
            ~ ^~~~~~~~~~~
pygraphviz/graphviz_wrap.c:2855:12: warning: incompatible pointer to integer conversion returning 'Agsym_t *' (aka 'struct Agsym_s *') from a function with result type 'int' [-Wint-conversion]
    return agattr(g, kind, name, val);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
pygraphviz/graphviz_wrap.c:2847:15: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
        len = strlen(val);
            ~ ^~~~~~~~~~~
pygraphviz/graphviz_wrap.c:4806:14: warning: explicitly assigning a variable of type 'void *' to itself [-Wself-assign]
  clientdata = clientdata;
  ~~~~~~~~~~ ^ ~~~~~~~~~~
6 warnings generated.
pygraphviz/graphviz_wrap.c:2040:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
                    res = SWIG_AddCast(res);
                    ~~~ ^              ~~~
pygraphviz/graphviz_wrap.c:2043:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
                    res = SWIG_AddCast(res);                
                    ~~~ ^              ~~~
pygraphviz/graphviz_wrap.c:2855:12: warning: incompatible pointer to integer conversion returning 'Agsym_t *' (aka 'struct Agsym_s *') from a function with result type 'int' [-Wint-conversion]
    return agattr(g, kind, name, val);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
pygraphviz/graphviz_wrap.c:4806:14: warning: explicitly assigning a variable of type 'void *' to itself [-Wself-assign]
  clientdata = clientdata;
  ~~~~~~~~~~ ^ ~~~~~~~~~~
4 warnings generated.
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.9-intel-2.7/pygraphviz/graphviz_wrap.o -L/usr/local/lib/graphviz -L/usr/local/lib/graphviz -lcgraph -lcdt -o build/lib.macosx-10.9-intel-2.7/pygraphviz/_graphviz.so
ld: library not found for -lcgraph
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1

有人知道如何解决这个问题吗?

1 个答案:

答案 0 :(得分:2)

确保您的XCode已更新为最新版本,然后尝试以下操作:

xcode-select --install

提示时安装命令行工具。然后尝试重建。