我一直在尝试使用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
这给了我一个工作的vim但没有python.
auto / 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
无论是否使用–with-python-conf-dir选项运行configure,我都会收到此错误.它看起来像-u _PyMac_Error Python.framework / Versions / 2.7 / Python是问题的根源,但我不知道从哪里开始.
有什么建议么?
解决方法:
原来这个bug实际上是在Python Makefile中,信不信由你.
打开文件
/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config
或者适合您的任何路径,并搜索PyMac_Error.它应该在定义LINKFORSHARED的行上,并且在这一行上你需要将PYTHONFRAMEWORKDIR更改为PYTHONFRAMEWORKINSTALLDIR.然后回到你的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
应该都指向
/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7
我不确定为什么我会在很多地方拥有它,或者如果那样糟糕,但它确实存在.