0

I have installed python-vlc using pip to python 3.7 and VLC Media Player. Both of them are 64-bit and the VLC Media Player directory has been added to my path variable and is even callable from the windows command line without fully defining the path.

Whenever I attempt to import vlc into a python script, I get the error

OSError: [WinError 126] The specified module could not be found

I have tried the following based on other questions on this site and answers on others:

  • Copying all of VLC into the \Python\Python37\Lib\site-packages directory (where vlc.py lives)
  • Copying vlc.py into the C:\Program Files\VideoLAN\VLC folder
  • I also installed the pywin32 library since it sounds like vlc.py tries to use it to find the libvlc.dll
  • Adding the vlc directory to my path
  • Rebooting the machine after each of these

I also tried adding the dll path to the PATH at runtime through python like this:

try:
    import vlc
except:
    from os import environ
    vlc_path = 'C:\\Program Files\\VideoLAN\\VLC'
    environ['PATH'] += ';' + vlc_path
    import vlc

I know that I am supposed to supply a code snippet that replicates the problem, but literally the most condensed version of this issue is here:

import vlc

I am out of ideas. Why can vlc.py not find libvlc.dll?

1 Answers1

0

You can try:

  • Create an environment variable called PYTHON_VLC_LIB_PATH and set it to C:\Program Files\VideoLAN\VLC\libvlc.dll

  • Create another environment variable called PYTHON_VLC_MODULE_PATH and set it to C:\Program Files\VideoLAN\VLC\

or

  • Update your Python from 3.7 to 3.9 (Worked for me)