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.

karthikr
  • 97,368
  • 26
  • 197
  • 188
Srik
  • 2,341
  • 2
  • 21
  • 35
  • make sure your python libraries is in `$LD_LIBRARY_PATH` and `$PATH` – Farhadix Nov 20 '13 at 19:39
  • 1
    @Farhadix `PATH` is irrelevant. Except that it must make appropriate python show up first *when building vim*. – ZyX Nov 20 '13 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. – ZyX Nov 20 '13 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. – Srik Nov 20 '13 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. – Srik Nov 20 '13 at 20:39
  • @Srik Installed by what? Also note that you should not add paths with libraries to `$PATH`, it will not do you any good. – ZyX Nov 20 '13 at 20:41
  • @ZyX I did not had python 3.3 in my machine, I downloaded and did a manual install with parameter '--enable-shared'. now when i type 'python3' it points to the 3.3 version. 2.7 was already there in my machine. I just found the folder containing shared libraries and provided it during VIM install. – Srik Nov 20 '13 at 20:48
  • @ZyX I manually installed vim 7.4.94 just now. I did not provide the --with-python-config-dir. It identified the python directories and I am not getting the errors now. Thanks for your help. – Srik Nov 20 '13 at 23:19

1 Answers1

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.

Cometsong
  • 568
  • 9
  • 21