6
  1. I have Python 2.7 and Python 3.3 in my Debian. I rebuilt both using the arg --enable-shared.

  2. After than I built VIM 7.4 using the args " --enable-pythoninterp --enable-python3interp --with-features=huge --with-python-config-dir=PathToConfig --with-python3-config-dir=PathToConfig"

  3. when i give the comment vim --version, I could see the flags '+python/dyn and +python3/dyn'

However when I type the command ':python import sys', I get the error message:

E448: Could not load library function _PyArg_Parse_SizeT
E263: Sorry, this command is disabled, the Python library could not be loaded.

When I type the command ':python3 import sys', I get the error message:

E448: Could not load library function PySys_SetArgv
E263: Sorry, this command is disabled, the Python library could not be loaded.

all the vim plugins that needs python is not working due to this.

Please let me know how to fix this.

8
  • make sure your python libraries is in $LD_LIBRARY_PATH and $PATH Commented Nov 20, 2013 at 19:39
  • 1
    @Farhadix PATH is irrelevant. Except that it must make appropriate python show up first when building vim. Commented Nov 20, 2013 at 20:26
  • 2
    You must build with just the same python library you are going to use vim with. These errors show up because you have build vim with one binary and trying to use it with the other. Normally you do not have to specify “--with-python-config-dir”, it will be determined by configure. Thus try building with these arguments omitted. Make sure you have appropriate -dev packages installed or it will not work. Commented Nov 20, 2013 at 20:29
  • @Farhadix I could see 'libpython2.7.so', 'libpython2.7.so.1' and 'libpython2.7.so.1.0' in /usr/lib and 'libpython3.so', 'libpython3.3m.so.1.0', 'libpython3.3m.so' and 'libpython3.3m.a' in /usr/local/lib. I have added both these path to $PATH. However when I do echo for $LD_LIBRARY_PATH, nothing is displayed. I am not able to modify it during load time. The VIM issue still remains after these changes. Commented Nov 20, 2013 at 20:35
  • @ZyX when I built VIM without the '--with-python-config-dir', I was getting error that config files not found. Hence I added these config parameters based on where these files were installed. Commented Nov 20, 2013 at 20:39

1 Answer 1

1

"Dynamic" Python loading is only available for use on Windows, unfortunately. I have looked into this as well, and it is not available on any other operating system.

The Vim docs: http://vimdoc.sourceforge.net/htmldoc/if_pyth.html#python-dynamic specify: "On MS-Windows the Python library can be loaded dynamically."

Basically the answer is: Nope, "dynamic" will not work on any Mac/*nix systems.

What I've done on my own system is to compile two versions of vim, one with Python2 and the other with Python3 links. Then in my .vimrc I include a version-check to use the right python exec for plugins, etc.

Sign up to request clarification or add additional context in comments.

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.