I've got Vim installed on MacOS using Brew and it installs with +python3 support for Python 3.7.2 by default.

I'm writing a Vim plugin which utilises some Python 3.7 and would like this to be able to work on parity with Linux with how it works on MacOS.

In a Docker container with Ubuntu Bionic I've tried installing Python 3.7.2 and Vim; and it installs Python 3.6 and links to this version.

I've tried installing Vim from source in the container and it will build for 3.6 but not for 3.7.

On Linux, running the following to configure the build:

./configure --with-features=huge --enable-cscope --enable-multibyte \
  --enable-rubyinterp --enable-pythoninterp --enable-python3interp \
  --with-python3-config-dir=/usr/lib/python3.7/config-3.7m-x86_64-linux-gnu \

fails with the message:

checking if compile and link flags for Python 3 are sane... no

I've thought of downgrading the MacOS Vim version to 3.6 and coding the plugin to that version but thought I would explore options to get it working on Linux with Python 3.7 first.

Also, if this is not the appropriate forum for this question, please let me know and I will move it to a stack-exchange site more appropriate.

  • Have you checked the faq vimhelp.org/vim_faq.txt.html#faq-35.10? Commented Jan 7, 2019 at 14:55
  • Thanks for that - I have now, still doesn't help - it's in a docker container and vim isn't preloaded. Commented Jan 7, 2019 at 21:33
  • and apt-get build-dep vim-gtk does not help? Commented Jan 8, 2019 at 6:36
  • thanks, but that's for the x11 dependencies - without installing anything else and running for build-dep it didn't even include +python letalone +python3 Commented Jan 8, 2019 at 13:09
  • 2
    I believe you need to install either python3-dev on Debian or python3-devel on Centos. Commented Sep 6, 2019 at 4:28

3 Answers 3


Probably your default python3 is 3.6. You need, then, tell the build process to use python3.7. You can do that with the parameters --with-python3-command:

./configure --with-python3-command=python3.7 \
            --with-python3-config-dir=/usr/lib/python3.7/config-3.7m-x86_64-linux-gnu \
            ... (other config params) ...



make clean distclean before running the configure command for vim. This worked for me. There was lots of cached items hanging around from before that were interfering with vim configure.

  • 1
    Welcome to Vi and Vim! Have you been able to try this with the OPs case? This answer could benefit from more detail specific to the question
    – D. Ben Knoble
    Commented Oct 25, 2019 at 14:06
  • This worked for me, it looks like after trying several commands around the repo is dirty, this will fix it.
    – calbertts
    Commented Jun 24, 2022 at 9:44

I had the same error message

checking if compile and link flags for Python 3 are sane... no

and was running essentially the same command. The issue was with the line:


which was incorrect.

I checked the actual location of the config using the output of:


and that fixed the issue.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.