Python vlc install problems

谁说胖子不能爱 提交于 2019-12-06 01:22:32

Your problem is that libvlc.dll is not in the PATH. There is 2 ways to correct that.

First (temporary):

set PATH=%PATH%;<path to your dll folder>

As explained in the second answer of this post: Adding directory to PATH Environment Variable in Windows

Second (Forever):

This solution makes the variable stay in the path for every reboot of your machine but you need root privilege. As before you need to put the way to your dll folder in the Path variable as explained on this site. (It depends from your system version): https://www.computerhope.com/issues/ch000549.htm

Other problem that may occur

Oftenly, people download 32bits vlc's version. This may cause some trouble if you installed the 64 bits version of python. (Windows Error [193]). To fix that, you just need to reinstall the 64 bits vlc's version.

Meng-Chiao Hsu

I had similar question. Here is my solution: First I checked the code in the file __init__.py. Print some variables like self._name and mode to make sure the values are correct. And I looked up the function _dlopen, which is LoadLibrary from _ctypes, and found out the mode argument is optional. So I try to modified the file without breaking the structure of whole file. Here is the code:

the original codes are:

if handle is None:
    self._handle = _dlopen(self._name, mode)
else:
    self._handle = handle

I modified the codes as below:

if handle is None:
    if 'libvlc' not in self._name:
        self._handle = _dlopen(self._name, mode)
    else:  # libvlc.dll will hit
        self._handle = _dlopen(self._name)
else:
    self._handle = handle

And it worked for me. Hope this solution can help people with the same problem.

Installing through pip does not install vlc itself, only the python wrapper for the libvlc bindings. To use them, you need to have a working VLC install. Please fetch VLC from www.videolan.org

I changed my vlc player from 32 bit to 64 and it worked. Just download 64-bit version of vlc player and install it. The write

import vlc

It will work

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!