在Ubuntu上使用python支持编译vim

2024-06-08 16:13:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图用Ubuntu上的python解释器从源代码编译vim。我已经为vim安装了依赖项,在Ubuntu上安装了python2.7-devel和python2.7-dbg包,并执行如下配置步骤

./configure --enable-pythoninterp --with-python-config-dir=/usr/lib/python2.7/config

配置目录不包含config.c文件。生成步骤失败,并出现以下错误。

...

objects/py_config.o:(.data+0xcc): undefined reference to `initcStringIO'
objects/py_config.o:(.data+0xd4): undefined reference to `initcPickle'
objects/py_config.o:(.data+0xdc): undefined reference to `initzlib'
collect2: ld returned 1 exit status
make: *** [vim] Error 1

我尝试过稳定的构建,在配置方面做了一些调整,但是没有找到一个明确的答案。另外,vim在没有python解释器的情况下构建。

这里是完整的

输出-http://paste.pocoo.org/show/577749/

错误-http://paste.pocoo.org/show/577752/

生成文件-http://paste.pocoo.org/show/577751/


Tags: topyorgconfighttpdataobjectsubuntu
3条回答

使用/usr/bin/python2.7-config --configdir获取configdir

即:

sudo apt-get build-dep vim 
hg clone https://vim.googlecode.com/hg/ vim
./configure --enable-pythoninterp --with-features=huge --prefix=$HOME/opt/vim --with-python-config-dir=$(/usr/bin/python2.7-config --configdir)
make && make install

在编译Vim之前,安装python-devpython2.7-dev(或者任何与python版本匹配的dev)。这两个包可能指向同一个文件,但对我有效。

在做了重要的研究之后回答我自己的问题。 在某些Ubuntu安装中查找vim正在查找的文件compilation may be missing

在意识到我继续定制安装Python源代码(./configure --prefix=/home/senthil/localpython; make; make install)之后,接着继续进行vim编译。

  1. 设置路径,使python指向新的本地安装。

    PATH=/home/senthil/localpython/bin:$PATH

  2. 然后使用以下标志启动编译。

    ./configure——启用pythoninterpr——使用features=huge——使用python config dir=/home/senthil/localpython/lib/python2.7/config

您应该看到vim使用本地python解释器编译得很好。据各种消息来源所知,这增加了vim的大小,我也觉得速度明显变慢了。在完成这个练习之后(以一种非常有耐心的方式),我想,我想使用系统编译的vim本身。

相关问题 更多 >