gpt4 book ai didi

python - 针对 EPD Canopy : no lib/config directory 编译 vim

转载 作者:行者123 更新时间:2023-11-28 17:46:43 25 4
gpt4 key购买 nike

我正在尝试针对 EPD Canopy 的 python 编译 vim,但是 ./configure 似乎无法找到正确的配置目录。这是我正在运行的命令

CC=clang ./configure --prefix=/usr/local \
--with-features=huge \
--enable-rubyinterp \
--enable-pythoninterp \
--enable-perlinterp \
--enable-cscope

这是输出的相关部分

checking --enable-pythoninterp argument... yes
checking for python... /Users/noah/Library/Enthought/Canopy_64bit/User/bin/python
checking Python version... 2.7
checking Python is 1.4 or better... yep
checking Python's install prefix... /Users/noah/Library/Enthought/Canopy_64bit/User
checking Python's execution prefix... /Users/noah/Library/Enthought/Canopy_64bit/User
checking Python's configuration directory...
can't find it!

现在,Canopy.app 包中有一个 config 目录,所以我也尝试添加标志 --with-python-config-dir=/Applications/Canopy.app/目录/lib/python2.7/config。哪个给出了错误

checking if compile and link flags for Python are sane... no: PYTHON DISABLED

zh我没主意了。感谢您的帮助。

最佳答案

确保首先运行 make distclean 以清除从失败构建中缓存的所有内容。

以下对我有用(在 Debian Wheezy 64 位上)(您需要将 $VIM_SRC$CANOPY_SRC 更改为任何位置你有 vim 和 canopy 目录)。

VIM_SRC=~/src/vim73
CANOPY_SRC=~/src/canopy

cd $VIM_SRC
make distclean
# Compile against canopy python and install in canopy dir, so that
# this vim is used when canopy is activated.
# YOU HAVE TO HAVE CANOPY ACTIVATED, i.e. `which python` points to canopy
# you also need python-config
# (this assumes you can install into your canopy install
# dir, but it isn't strictly necessary)
APPDATA=$CANOPY_SRC/appdata/canopy-1.0.3.1262.rh5-x86_64
PYTHON_CONFIG=$APPDATA/lib/python2.7/config
# I'm installing here so that this is the vim used when I start the virtualenv,
# but you can put it where you like.
INSTALL_DIR=$CANOPY_SRC/Enthought/Canopy_64bit/User/

# force vim to use this python binary
export vi_cv_path_python=$APPDATA/bin/python
./configure --prefix=$INSTALL_DIR \
--with-features=big \
--enable-pythoninterp=yes \
--with-python-config-dir=$PYTHON_CONFIG \
# I didn't actually need these flags. python-config is a helper script
# that comes with the Debian package python-dev. I'm leaving them here
# in case someone finds them useful.
# CFLAGS="`python-config --includes`" \
# LIBS="`python-config --libs`" \
# LDFLAGS="`python-config --ldflags`"
make
make install

技巧是设置 vi_cv_path_python 以强制 vim 使用可以导入站点的 python。

测试

vim -c ':py import os; print os.__file__'

这将无法导入共享对象,例如 vim -c ':py import zmq'LD_LIBRARY_PATH 可以 fix这个。

设置LD_LIBRARY_PATH后调用vim:

alias vim="LD_LIBRARY_PATH='$APPDATA/lib' vim"

问题

如果您使用 CFLAGS="python-config --cflags" 或根本不提供,旧版本的 Vim 将失败。这是因为这在 gcc args 中包含 -O2 并且这将导致 vim 为 segfault。 .这就是我放置 --includes 的原因。 我的解决方案适用于最新的 development snapshot .

关于python - 针对 EPD Canopy : no lib/config directory 编译 vim,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17200655/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com