简体   繁体   English

使用 Python3(通过 Homebrew 安装)支持编译 vim?

[英]Compiling vim with Python3 (installed via Homebrew) support?

I have python3 installed via homebrew: brew install python3 --framework我通过自制软件安装了 python3: brew install python3 --framework

I have the vim source (7.3) downloaded in /usr/src我在/usr/src中下载了 vim 源代码(7.3)

I run:我跑:

./configure --prefix=/usr/local --enable-rubyinterp --enable-python3interp --disable-gpm --enable-gui=no --enable-multibyte

And in my src/auto/config.log I see:在我的src/auto/config.log我看到:

configure:5442: checking --enable-python3interp argument   
configure:5451: result: yes  
configure:5456: checking for python3  
configure:5489: result: no

I googled around some, and found this , so I tried making the symlink for python3.2 and then running configure like this:我搜索了一些,发现 了这个,所以我尝试为 python3.2 制作符号链接,然后像这样运行配置:

./configure --prefix=/usr/local --enable-rubyinterp --enable-python3interp --disable-gpm --enable-gui=no --enable-multibyte --with-python3-config-dir=/usr/local/Cellar/python3/3.2/Frameworks/Python.framework/Versions/3.2/lib/python3.2/config-3.2m

And my log shows the same error.我的日志显示了同样的错误。 What do I need to do to get vim compiled with Python3 support?我需要做什么才能获得使用 Python3 支持编译的 vim?

And no: I do not want to use MacVim.不:我不想使用 MacVim。


➜ ls -al /System/Library/Frameworks/Python.framework/Versions 
total 16
drwxr-xr-x   7 root  wheel  238 May 28 15:33 .
drwxr-xr-x   7 root  wheel  238 Sep 21  2010 ..
drwxr-xr-x   8 root  wheel  272 Sep 17  2010 2.3
drwxr-xr-x  12 root  wheel  408 Dec  1 12:49 2.5
drwxr-xr-x  12 root  wheel  408 Dec  1 12:49 2.6
lrwxr-xr-x   1 root  wheel   70 May 28 15:33 Current -> /usr/local/Cellar/python3/3.2/Frameworks/Python.framework/Versions/3.2
lrwxr-xr-x   1 root  wheel    3 Sep 17  2010 old-Current -> 2.6

➜ which python3.2
/usr/local/bin/python3.2

UPDATE: I've gotten it working a la this post with Python 2.7.1 via Homebrew, but still no joy with Python 3...更新:我已经通过 Homebrew 使用 Python 2.7.1 完成了这篇文章,但对 Python 3 仍然不满意...

There is a problem with the configure script.配置脚本有问题。 Since python 3.2 the config and include directories get the abiflag included (see PEP 3149).由于 python 3.2 配置和包含目录包含 abiflag(请参阅 PEP 3149)。

The next problem is that the configure script parses the python config and the flags for the linker are not correct for a framework build, so the test program from the configure script fails to build.下一个问题是配置脚本解析 python 配置,并且 linker 的标志对于框架构建不正确,因此配置脚本中的测试程序无法构建。

I already send a patch to vim and it got included (the mercurial repo has it).我已经向 vim 发送了一个补丁,它被包含在内(mercurial repo 有它)。

`./configure --enable-python3interp vi_cv_path_python3=/usr/local/bin/python3.2`

should work.应该管用。

Vim Patch: https://github.com/codedreality/vim/tree/fix-python3x-support Vim 补丁: https://github.com/codedreality/vim/tree/fix-python3x-support

MacVim Patch: https://github.com/codedreality/macvim/tree/fix-python3x-support MacVim 补丁: https://github.com/codedreality/macvim/tree/fix-python3x-support

When you test to see if it worked, make sure you use the Vim binary created by the build - not the mvim script.当您测试它是否有效时,请确保您使用由构建创建的 Vim 二进制文件 - 而不是 mvim 脚本。 mvim (even if you call the version on your source tree) will look in /Applications/ for MacVim.app first. mvim(即使您调用源代码树上的版本)将首先在 /Applications/ 中查找 MacVim.app。

Maybe this will give you some joy:也许这会给你一些快乐:

./configure \
  --enable-python3interp=dynamic \
  --with-python3-config-dir=/usr/local/Cellar/python3/3.2/Frameworks/Python.framework/Versions/3.2/lib/python3.2/config/

I change the macvim titlebar color is black.My macvim colorsechme is ayu dark.我将 macvim 标题栏颜色更改为黑色。我的 macvim colorsechme 是 ayu 深色。 Change macvim MMWindow.m line 93,append following code:更改 macvim MMWindow.m第 93 行,append 以下代码:

[self setTitleVisibility:NSWindowTitleHidden];
[self setTitlebarAppearsTransparent:YES];
self.backgroundColor = NSColor.blackColor;

Complier source code with following command:使用以下命令编译源代码:

./configure --with-features=huge --enable-multibyte --with-macarchs=x86_64 --enable-perlinterp --enable-rubyinterp --enable-tclinterp --enable-terminal --enable-python3interp --with-properly-linked-python2-python3 --enable-python3interp=yes --enable-cscope 

enter image description here在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM