Installing pygraphviz on OS X 10.7.5

只谈情不闲聊 提交于 2019-12-11 14:15:40

问题


I am trying to install pygraphviz on Mac OS 10.7.5 running Anaconda Python. In the last installation step, I get this error:

$ 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

My initial troubleshooting from a host of related questions led me to these actions:

  • Check the Python version: $ python --version gives me Python 2.7.5 :: Anaconda 1.5.1 (x86_64)
  • Check that Graphviz is installed: done! I can run graphviz both as a standalone application and from the command line. For instance: $ which neato gives me /usr/local/bin/neato.
  • Update the library_path and include_path in setup.py: done! (See the error report above -- both of these paths are valid on my system)
  • Install XCode 4 and install command line tools: done! $ xcode-select -version gives me xcode-select version 2308.
  • Export ARCHFLAGS: done! This was done in what I call incantation mode -- I have no idea what it was supposed to do, just that it seemed to help another user. I used this: export ARCHFLAGS='-arch i386 -arch x86_64' before running sudo python setup.py install again.
  • Switch XCode: Also in incantation mode I vainly tried: sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/. I got this from another SO answer but have lost the link, sorry...

Apart from switching away from OS X, is there anything else I should do? (Also tagging this as networkx-related since that package also uses pygraphviz).

来源:https://stackoverflow.com/questions/17132364/installing-pygraphviz-on-os-x-10-7-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!