当我尝试在终端中运行 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/
最佳答案
安装时出现确切的 IOError spf13-vim在我的开发机器上...
这解决了问题:
$ sudo mkdir -p /usr/include/python2.7
$ sudo ln -s /System/Library/Frameworks/Python.framework/Versions/Current/include/python2.7/pyconfig.h /usr/include/python2.7/pyconfig.h
采取 from here .
关于python - 当我尝试在命令行中运行 vim 时出现 Python 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13441820/