Python 311 call fails

403 views
Skip to first unread message

Ni Va

unread,
Oct 27, 2021, 9:58:42 AM10/27/21
to vim_use
Hi,

Got this error on pyhton3 print('foo')
E370: Could not load library python311.dll: Le module sp<e9>cifi<e9> est introuvable.
E263: Sorry, this command is disabled, the Python library could not be loaded.

This is my configuration

1) redir @a | echomsg system('where python311.dll') | redir END | put=@a
  C:\Python311\python311.dll^@S:\path\Vim\to\python\x86\python311.dll^@

2) echomsg filereadable('S:\path\Vim\to\python\x86\python311.dll')

3) VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Oct 27 2021 15:23:19)
MS-Windows 32-bit GUI version with OLE support
Included patches: 1-3565
Compiled by ni.va@
Huge version with GUI.  Features included (+) or not (-):
+cmdline_compl      +file_in_path       +lua/dyn            -python             -termguicolors      +windows
+cmdline_hist       +find_in_path       +menu               +python3/dyn        +terminal           +writebackup
Compilation: gcc -I. -Iproto -DWIN32 -DWINVER=0x0600 -D_WIN32_WINNT=0x0600 -DHAVE_PATHDEF -DFEAT_HUGE -DHAVE_STDINT_H -DHAVE_GETTEXT -DHAVE_LOCALE_H -DDYNAMIC_GETTEXT -DFEAT_OLE -DFEAT_CSCOPE -DFEAT_NETBEANS_INTG -DFEAT_JOB_CHANNEL -DFEAT_IPV6 -DHAVE_INET_NTOP -DFEAT_TERMINAL -DFEAT_SOUND -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD -DFEAT_MBYTE_IME -DDYNAMIC_IME -DDYNAMIC_ICONV -pipe -march=i686 -Wall -I./lua-5.3.5/src/include -I./lua-5.3.5/src -DFEAT_LUA -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL="lua53.dll" -DFEAT_RUBY -I C:/Ruby30/include/ruby-3.0.0 -I C:/Ruby30/include/ruby-3.0.0/i386-mingw32 -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL="msvcrt-ruby300.dll" -DRUBY_VERSION=30 -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL="python311.dll" -O3 -fomit-frame-pointer -freg-struct-return
Linking: g++ -I. -Iproto -DWIN32 -DWINVER=0x0600 -D_WIN32_WINNT=0x0600 -DHAVE_PATHDEF -DFEAT_HUGE -DHAVE_STDINT_H -DHAVE_GETTEXT -DHAVE_LOCALE_H -DDYNAMIC_GETTEXT -DFEAT_OLE -DFEAT_CSCOPE -DFEAT_NETBEANS_INTG -DFEAT_JOB_CHANNEL -DFEAT_IPV6 -DHAVE_INET_NTOP -DFEAT_TERMINAL -DFEAT_SOUND -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD -DFEAT_MBYTE_IME -DDYNAMIC_IME -DDYNAMIC_ICONV -pipe -march=i686 -Wall -I./lua-5.3.5/src/include -I./lua-5.3.5/src -DFEAT_LUA -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL="lua53.dll" -DFEAT_RUBY -I C:/Ruby30/include/ruby-3.0.0 -I C:/Ruby30/include/ruby-3.0.0/i386-mingw32 -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL="msvcrt-ruby300.dll" -DRUBY_VERSION=30 -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL="python311.dll" -O3 -fomit-frame-pointer -freg-struct-return -s -municode -mwindows -o gvim.exe -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lnetapi32 -lversion -lwsock32 -lws2_32 -ld2d1 -ldwrite -loleaut32 -lwinmm -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic -lgcc_eh -Wl,-Bstatic -lwinpthread -Wl,-Bdynamic -lole32 -luuid      

Message has been deleted
Message has been deleted
Message has been deleted

Ni Va

unread,
Nov 2, 2021, 12:09:20 PM11/2/21
to vim_use
Fixed

Solved / Fixed :

1. Copied python311.dll, python3.dll, vcruntime140.dll in your distro path  expand('$vim/extensions/python/x86')

2. Put this in your _vimrc

  if has('win32')
  var py3extenspath: string = expand('$vim/extensions/python/x86/')
if isdirectory( py3extenspath )
  var py3dllpath = py3extenspath .. 'python311.dll'
  if !filereadable(py3dllpath)
  else
var pythonthree_homes: list<string> = system('where "python311.dll"')->split('\n')->filter('v:val =~ "extensions"')
py3dllpath = pythonthree_homes[0]->fnamemodify(':p:gs?\\?/?')
  endif
  execute 'set pythonthreehome=' .. py3extenspath
  execute 'set pythonthreedll='  .. py3dllpath->fnamemodify(':p:gs?\\?/?')
endif
  endif

3. Testing Py3 v3.11 interface 
nnoremap <silent> <F8>   :exec 'py3 import sys'<cr> :exec 'py3 print(''python3 hell working'')'<cr>
Reply all
Reply to author
Forward
0 new messages