在OS X 10.7.5上安装pygraphviz

时间:2013-06-16 10:33:57

标签: python macos python-2.7 networkx pygraphviz

我正在尝试在运行Anaconda Python的Mac OS 10.7.5上安装pygraphviz。在上一个安装步骤中,我收到此错误:

$ sudo python setup.py install
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
/usr/bin/clang -fno-strict-aliasing -I/Users/user2490492/anaconda/include 
-arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -DNDEBUG 
-g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/include/graphviz -
I/Users/user2490492/anaconda/include/python2.7 
-c pygraphviz/graphviz_wrap.c 
-o build/temp.macosx-10.5-x86_64-2.7/pygraphviz/graphviz_wrap.o
In file included from pygraphviz/graphviz_wrap.c:124:
/Users/user2490492/anaconda/include/python2.7/Python.h:33:10: 
fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1

我从一系列相关问题中进行的初步故障排除促使我采取了以下措施:

  • 检查Python版$ python --version给我Python 2.7.5 :: Anaconda 1.5.1 (x86_64)
  • 检查Graphviz已安装:完成!我可以将graphviz作为独立应用程序和命令行运行。例如:$ which neato给了我/usr/local/bin/neato
  • Update the library_path and include_path in setup.py :完成了! (参见上面的错误报告 - 这两个路径在我的系统上都有效)
  • Install XCode 4 and install command line tools :完成了! $ xcode-select -version给了我xcode-select version 2308.
  • Export ARCHFLAGS :完成了!这是在我称之为咒语模式的情况下完成的 - 我不知道应该做什么,只是它似乎有助于其他用户。我在再次运行export ARCHFLAGS='-arch i386 -arch x86_64'之前使用了此sudo python setup.py install
  • 切换XCode :同样在咒语模式下,我徒劳地试过:sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/。我从另一个SO答案中得到了这个但是丢失了链接,对不起......

除了切换到OS X之外,还有什么我应该做的吗? (同样将其标记为networkx - 因为该包也使用pygraphviz)。

0 个答案:

没有答案