简洁的想法

仁爱、喜乐、和平、忍耐、恩慈、良善、信实、温柔、节制

Mac Octopress IOError Invalid Python Installation

| Comments

经过这么多天的与Warning的邂逅,今天终于开云见日迎来了一个Error. 就在全国人民喜迎这个IOError之际,我三省吾身,不知道是因为升级了Mountain Lion 还是因为我最近折腾系统太厉害的缘故,好好的一个Octopress今天居然在rake generate的时候给我报错:

1
2
3
4
5
6
7
8
9
10
11
Building site: source -> public
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 565, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 547, in main
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 278, in addusersitepackages
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 253, in getusersitepackages
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 243, in getuserbase
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 523, in get_config_var
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 419, in get_config_vars
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 298, in _init_posix
IOError: invalid Python installation: unable to open /usr/include/python2.7/pyconfig.h (No such file or directory)

前面一堆文件都是在/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/,不知道为什么最后会找到这个文件夹去/usr/include/python2.7/

这类找不到文件的问题在*nix下其实还是很好解决的,只要我能找到这个文件, 再把它ln过去就好了:

1
2
$ sudo mkdir /usr/include/
$ sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/ /usr/include/python2.7

Comments