7

I have download the source code of vim7.4 and decide to upgrade the vim to 7.4. However, I can not add python support to it:

./configure  --enable-pythoninterp  --enable-rubyinterp --enable-gui=no --without-x --enable-cscope --enable-multibyte --prefix=/usr

While checking src/auto/config.log, I found:

configure:5592: checking Python's configuration directory
configure:5614: result:·
configure:5620: result: can't find it!

Installed python info:

dpkg-query -l python
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                             Version                          Description
+++-================================-================================-   ================================================================================
ii  python                           2.7.3-0ubuntu2.2                 interactive high-level object-oriented language (default version)

After invoking make in the src dir:

./vim --version | grep python
+cryptv          +linebreak       -python          +viminfo
+cscope          +lispindent      -python3         +vreplace

It seems that it's caused by vim unable to locate the config dir for python. How to fix it?

Thanks for your insights in advance.

2

4 Answers 4

17

Make sure you have the python development packages installed (python-devel or python-dev I think). You can specify the python config directory by passing, to ./configure, something like:

--with-python-config-dir=/usr/lib64/python2.7/config

To find the config directory (you may need to do updatedb first):

locate python | grep '/config$'
Sign up to request clarification or add additional context in comments.

6 Comments

I have tried to add --with-python-config-dir= /usr/lib/python2.7/config into the ./configuration command flag. Encounter new problem on make: -I/usr/include/python2.7 -DPYTHON_HOME='"/usr"' -pthread -fPIE -o objects/if_python.o if_python.c if_python.c:58:20: fatal error: Python.h: No such file or directory compilation terminated. make: *** [objects/if_python.o] Error 1
~  locate python | grep '/config$' /usr/lib/python2.7/config
do you have the python development package installed? And what is the output of locate Python.h
On Mac OS X, python3 installed by homebrew. I used the command `locate python3 | grep '/config$', but nothing output on terminal. What can I do next? @perreal
i run rm src/auto/config.cache && ./configure --enable-pythoninterp=yes --prefix=/data/exec/vim --with-python-command=/data/exec/python2.7/bin/python2.7 and DO NOT forget rm src/auto/config.cache, or you will got 'too old' version python hint if you do compile with python2.6 before
|
10

From your error messages you don't have python-dev installed

sudo apt-get install python-dev

this should fix your problem

1 Comment

+1, this will install the header files for the Python source that Vim needs.
3

Make sure you have installed the development packages for python and point towards the appropriate config directory.

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

Comments

0

The other answers give the correct solution i.e adding the cli switch

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

Also it might be a good idea to run

make clean distclean

For me without cleaning the existing build it wouldn't pickup the new configs

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.