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:
当我尝试在终端中运行vim(以便在另一个问题中遵循@romainl的建议)时,我得到了很多Python错误,这些错误归结为:
IOError: invalid Python installation: unable to open /usr/include/python2.7/pyconfig.h (No such file or directory)
Why is this? I can use Python or Sublime Text even, without any problems.
这是为什么呢?即使没有任何问题,我也可以使用Python或升华文本。
The full list of errors is the following:
错误的完整列表如下:
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)
Extra info:
I am on Mac OS X Mountain Lion (OS 10.8)
额外信息:我在Mac OS X Mountain Lion上(OS 10.8)
EDIT:
I tried @BobDunakey idea with no success, the idea was to use sudo
. I still get the same errors.
编辑:我尝试了@BobDunakey的想法,但没有成功,我的想法是使用sudo。我还是会犯同样的错误。
EDIT 2:
I was able to solve the problem thanks to Zirak's solution, which is the following: http://clearfix.be/2012/08/05/fix-mountain-lion-10-8-python-ioerror-pyconfig-h-error/
编辑2:多亏了Zirak的解决方案,我才解决了这个问题
5 个解决方案
#1
8
Just had the exact IOError while installing spf13-vim on my dev machine...
在我的dev机器上安装spf13-vim时,只有准确的IOError。
This fixes the problem:
这个修复存在的问题:
$ 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
Taken from here.
取自这里。
#2
1
You are probably using the default Vim (/usr/bin/vim
). You should use MacVim's CLI executable instead: $ /path/to/MacVim.app/Contents/MacOS/vim
.
您可能正在使用默认的Vim (/usr/bin/ Vim)。您应该使用MacVim的CLI可执行文件:$ /path/to/MacVim.app/ content /MacOS/vim。
MacVim comes with a mvim
script. Put it somewhere in your $PATH
and simply do $ mvim -v
.
MacVim附带了一个mvim脚本。把它放在你的$PATH中,简单地做$ mvim -v。
#3
1
EDIT:
编辑:
find the package that installed it with:
找到安装它的软件包:
dpkg -S /usr/include/python2.7/pyconfig.h
Then reinstall the package:
然后重新安装包:
apt-get install --reinstall <package name>
If that doesn't work download the package @:
如果不行,下载这个包@:
http://packages.ubuntu.com/oneiric/amd64/python2.7-minimal/download
http://packages.ubuntu.com/oneiric/amd64/python2.7-minimal/download
and manually install them with:
并手动安装:
$ sudo dpkg -i python2.7-minimal_2.7.2-5ubuntu1_amd64.deb
2ND EDIT:
编辑2:
Another user here had the same issue:
这里的另一个用户也有同样的问题:
ViM-LaTeX, python, and Mac OS 10.8.1 and a weird error
ViM-LaTeX、python和Mac OS 10.8.1以及一个奇怪的错误
seemed to fix it buy installing Xcode and the command line tools.
似乎修复了它购买了安装Xcode和命令行工具。
Worth a shot imo.
国际海事组织一个强心针。
#4
0
I was able to solve the problem thanks to Zirak's solution, which is the following: http://clearfix.be/2012/08/05/fix-mountain-lion-10-8-python-ioerror-pyconfig-h-error/
我之所以能够解决这个问题,多亏了Zirak的解决方案:http://clearfix.be/2012/08/05/fix- - - - - - - - - - - - - - - - - - - - - - - - -
Sorry guys for accepting this one, but since neither of your solutions solved it for me, and Zirak's is a comment, I decided to answer the question myself. :)
很抱歉大家接受了这个问题,但是因为你们的解决方案都没有帮我解决,而且Zirak的是一个评论,所以我决定自己回答这个问题。:)
#5
0
trying to run 'kodi' (xbmc) #output: /usr/include/python2.7/pyconfig.h (No such file or directory)
尝试运行'kodi' (xbmc) #输出:/usr/include/python2.7/pyconfig。h(无此文件或目录)
$ ls which python
-l # -rwxrwxr-x 1 someone1 someone1 2993744 Dec 2 11:40 /home/someone1/bin/python
$ l * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
$ mv /home/someone1/bin/python /home/someone1/bin/python1
美元mv /home/someone1/bin/python /home/someone1/bin/python1
$ which python #output: /usr/bin/python
美元的python #输出:/usr/bin/python
now it works !
#1
8
Just had the exact IOError while installing spf13-vim on my dev machine...
在我的dev机器上安装spf13-vim时,只有准确的IOError。
This fixes the problem:
这个修复存在的问题:
$ 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
Taken from here.
取自这里。
#2
1
You are probably using the default Vim (/usr/bin/vim
). You should use MacVim's CLI executable instead: $ /path/to/MacVim.app/Contents/MacOS/vim
.
您可能正在使用默认的Vim (/usr/bin/ Vim)。您应该使用MacVim的CLI可执行文件:$ /path/to/MacVim.app/ content /MacOS/vim。
MacVim comes with a mvim
script. Put it somewhere in your $PATH
and simply do $ mvim -v
.
MacVim附带了一个mvim脚本。把它放在你的$PATH中,简单地做$ mvim -v。
#3
1
EDIT:
编辑:
find the package that installed it with:
找到安装它的软件包:
dpkg -S /usr/include/python2.7/pyconfig.h
Then reinstall the package:
然后重新安装包:
apt-get install --reinstall <package name>
If that doesn't work download the package @:
如果不行,下载这个包@:
http://packages.ubuntu.com/oneiric/amd64/python2.7-minimal/download
http://packages.ubuntu.com/oneiric/amd64/python2.7-minimal/download
and manually install them with:
并手动安装:
$ sudo dpkg -i python2.7-minimal_2.7.2-5ubuntu1_amd64.deb
2ND EDIT:
编辑2:
Another user here had the same issue:
这里的另一个用户也有同样的问题:
ViM-LaTeX, python, and Mac OS 10.8.1 and a weird error
ViM-LaTeX、python和Mac OS 10.8.1以及一个奇怪的错误
seemed to fix it buy installing Xcode and the command line tools.
似乎修复了它购买了安装Xcode和命令行工具。
Worth a shot imo.
国际海事组织一个强心针。
#4
0
I was able to solve the problem thanks to Zirak's solution, which is the following: http://clearfix.be/2012/08/05/fix-mountain-lion-10-8-python-ioerror-pyconfig-h-error/
我之所以能够解决这个问题,多亏了Zirak的解决方案:http://clearfix.be/2012/08/05/fix- - - - - - - - - - - - - - - - - - - - - - - - -
Sorry guys for accepting this one, but since neither of your solutions solved it for me, and Zirak's is a comment, I decided to answer the question myself. :)
很抱歉大家接受了这个问题,但是因为你们的解决方案都没有帮我解决,而且Zirak的是一个评论,所以我决定自己回答这个问题。:)
#5
0
trying to run 'kodi' (xbmc) #output: /usr/include/python2.7/pyconfig.h (No such file or directory)
尝试运行'kodi' (xbmc) #输出:/usr/include/python2.7/pyconfig。h(无此文件或目录)
$ ls which python
-l # -rwxrwxr-x 1 someone1 someone1 2993744 Dec 2 11:40 /home/someone1/bin/python
$ l * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
$ mv /home/someone1/bin/python /home/someone1/bin/python1
美元mv /home/someone1/bin/python /home/someone1/bin/python1
$ which python #output: /usr/bin/python
美元的python #输出:/usr/bin/python