Vim无法在OS X上使用python进行编译

Mar*_*ill 7 python macos vim compilation

我一直在尝试使用mac OS X 10.6上的python 2.7支持编译vim 7.3.Vim本身编译得很好,但嵌入式python并没有那么多.

我采取的步骤:

hg clone https:/vim.googlecode.com/hg/ vim
cd vim/src
./configure --without-x --disable-gui --disable-darwin \
            --enable-pythoninterp --with-features=huge
make
make install
Run Code Online (Sandbox Code Playgroud)

这给了我一个工作的vim但没有python.

自动/的config.log表示有一个文件错误:

configure:5387: checking if compile and link flags for Python are sane
configure:5404: gcc -o conftest -g -O2 
     -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 
     -DPYTHON_HOME=\"/Library/Frameworks/Python.framework/Versions/2.7\"   
     -L/usr/local/lib conftest.c  
     -L/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config 
     -lpython2.7 -ldl -framework CoreFoundation 
     -u _PyMac_Error Python.framework/Versions/2.7/Python >&5
i686-apple-darwin10-gcc-4.2.1: Python.framework/Versions/2.7/Python: No such file or directory

<command-line>: warning: missing terminating " character
configure:5404: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define UNIX 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_WAIT_H 1
| #define FEAT_HUGE 1
| #define USE_XSMP_INTERACT 1
| /* end confdefs.h.  */
| 
| int
| main ()
| {
|  
|   ;
|   return 0;
| }
configure:5408: result: no: PYTHON DISABLED
Run Code Online (Sandbox Code Playgroud)

无论是否使用--with-python-conf-dir选项运行configure,我都会收到此错误.它看起来像-u _PyMac_Error Python.framework/Versions/2.7/Python问题的根源,但我不知道从哪里开始.

有什么建议?

小智 7

原来这个bug实际上是在Python Makefile中,信不信由你.

打开文件

/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config
Run Code Online (Sandbox Code Playgroud)

或适合您的任何路径,并搜索PyMac_Error.它应该在定义的行上LINKFORSHARED,并且在此行上您需要更改PYTHONFRAMEWORKDIRPYTHONFRAMEWORKINSTALLDIR.然后回到你的vim源和./configure,一切都应该顺利.

还要确保将OS X的Python框架符号链接到Homebrew Cellar中的框架:

/Library/Frameworks/Python.framework/Versions/2.7
/Library/Frameworks/Python.framework/Versions/Current
/System/Library/Frameworks/Python.framework/Versions/2.7
/System/Library/Frameworks/Python.framework/Versions/Current
Run Code Online (Sandbox Code Playgroud)

应该都指向

/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7
Run Code Online (Sandbox Code Playgroud)

我不确定为什么我会在很多地方拥有它,或者如果那样糟糕,但确实如此.


Mar*_*ill 0

Romainl 给出了公认的答案:MacVim附带了 vim 的命令行版本以及 gui 版本 - 我不知道这一点 - 并且我已经使用 Python 2.7 成功编译了 MacVim(没有遇到任何我遇到的问题)标准 vim 源)。

我没有考虑使用 macports 或 homebrew。

请注意,如果有人可以将此答案分配给 Romainl,请继续这样做。我只是回答自己来结束这个。