【发布时间】:2015-01-13 14:34:42
【问题描述】:
当我尝试在终端中运行 vim(以便跟随 @romainl's suggestion in my other question)时,我得到了很多 Python 错误,这些都归结为:
IOError: invalid Python installation: unable to open /usr/include/python2.7/pyconfig.h (No such file or directory)
这是为什么?我甚至可以毫无问题地使用 Python 或 Sublime Text。
完整的错误列表如下:
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)
额外信息:
我在 Mac OS X Mountain Lion (OS 10.8) 上
编辑:
我尝试了@BobDunakey 的想法但没有成功,这个想法是使用sudo。我仍然遇到同样的错误。
编辑 2:
多亏了 Zirak 的解决方案,我能够解决这个问题,如下所示:http://clearfix.be/2012/08/05/fix-mountain-lion-10-8-python-ioerror-pyconfig-h-error/
【问题讨论】:
-
这能解决吗? clearfix.be/2012/08/05/…
-
@Zirak 太棒了!那解决了它。谢谢! :)