当我尝试在命令行中运行 vim 时,出现 Python 错误 [英] When I try to run vim in command line I get Python errors

查看:39
本文介绍了当我尝试在命令行中运行 vim 时,出现 Python 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在终端中运行 vim 时(以便遵循 @romainl 在我的其他问题中的建议)我得到很多 Python 错误,都归结为:

When I try running vim in the Terminal (so as to follow @romainl's suggestion in my other question) I get lots of Python errors, which all boil down to:

IOError: invalid Python installation: unable to open /usr/include/python2.7/pyconfig.h (No such file or directory)

这是为什么?我什至可以使用 Python 或 Sublime Text,没有任何问题.

Why is this? I can use Python or Sublime Text even, without any problems.

完整的错误列表如下:

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)

Extra info:
I am on Mac OS X Mountain Lion (OS 10.8)


我尝试了@BobDunakey 的想法但没有成功,这个想法是使用 sudo.我仍然遇到相同的错误.


I tried @BobDunakey idea with no success, the idea was to use sudo. I still get the same errors.

编辑 2:
由于 Zirak 的解决方案,我能够解决问题,如下所示:http://clearfix.be/2012/08/05/fix-mountain-lion-10-8-python-ioerror-pyconfig-h-error/

推荐答案

在安装 spf13-vim 在我的开发机器上...

Just had the exact IOError while installing spf13-vim on my dev machine...

这解决了问题:

$ 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

取自此处.

这篇关于当我尝试在命令行中运行 vim 时,出现 Python 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆