gpt4 book ai didi

Python vlc install problems(Python vlc安装问题)

转载 作者:bug小助手 更新时间:2023-10-25 16:50:13 27 4
gpt4 key购买 nike



alright so i am trying to install vlc with pip and its telling me successfully installed python-vlc ok good that's what i wanted but when i go to run the program im trying to use vlc in witch is here

好的,我正在尝试用pip安装vlc,它告诉我已成功安装了python-vlc,好的,这就是我想要的,但当我开始运行程序时,我尝试在witch中使用vlc。



import vlc
p = vlc.MediaPlayer("https://www.youtube.com/watch?v=jC1vtG3oyqg")
p.play()


i am told this

我听说了这件事



Traceback (most recent call last):
File "C:\Users\Matt\Desktop\test2.py", line 1, in <module>
import vlc
File "C:\Python27\lib\site-packages\vlc.py", line 173, in <module>
dll, plugin_path = find_lib()
File "C:\Python27\lib\site-packages\vlc.py", line 150, in find_lib
dll = ctypes.CDLL('libvlc.dll')
File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found


im not sure what i am suppose to do since there are errors in the vlc program ( i think ) if you could help me out and get this working for me that would be amazing thank you so much!!

我不知道我应该做什么,因为在VLC程序中有错误(我想),如果你能帮助我,让它为我工作,那就太棒了,谢谢你!


更多回答

can you try where libvlc.dll in a CMD console? you may need to put VLC directory in your PATH.

您能在CMD控制台中尝试在哪里使用libvlc.dll吗?您可能需要将VLC目录放入您的路径中。

im told INFO: Could not find files for the given pattern(s)

我被告知信息:找不到给定图案的文件(S)

locate this DLL in your system (using "search") starting in program files (where VLC is installed). Once located, add the location to your path.

从程序文件(安装VLC的位置)开始,在您的系统中找到此DLL(使用“搜索”)。找到后,将位置添加到您的路径中。

@Jean-FrançoisFabre Hello I am having the same trouble at the moment and u guessed right where libvlc.dll return no PATH (and return an error). But I found it in the folder of VLC. Do you know how i can make windows recognize it.

@Jean-FrançoisFabre你好,我现在也遇到了同样的问题,您猜对了libvlc.dll在哪里不返回路径(并返回错误)。但我在VLC的文件夹里找到了它。你知道我怎么才能让Windows识别它吗。

quick hack: I would copy it in C:\Python27\lib\site-packages (same place as the python file) or somewhere you have the path pointing to like C:\windows\system32

快速解决方法:我会将其复制到C:\Python27\lib\Site-Packages(与python文件相同的位置)或您有路径指向的位置,如C:\Windows\Syst32

优秀答案推荐

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

您的问题是libvlc.dll不在路径中。有两种方法可以纠正这一点。


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

正如本文的第二个回答所解释的:在Windows中将目录添加到PATH环境变量


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

此解决方案使变量在每次重新启动机器时都保留在路径中,但您需要根权限。和以前一样,您需要将DLL文件夹的路径放在PATH变量中,如本站点所述。(取决于您的系统版本):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.

人们经常下载32位的VLC版本。如果您安装的是64位版本的python,这可能会带来一些麻烦。(Windows错误[193])。要解决这个问题,你只需要重新安装64位的VLC版本。



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:

我也有类似的问题。下面是我的解决方案:首先,我检查了__init__. py文件中的代码。打印一些变量,如self。_ name和mode以确保值正确。我查找了函数_dlopen,也就是LoadLibrary from _ctypes,发现mode参数是可选的。所以我尝试修改文件,而不破坏整个文件的结构。代码如下:



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.

希望这个解决方案能帮助有同样问题的人。



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

我把我的VLC播放器从32位改为64位,它起作用了。只需下载64位版本的VLC播放器并安装即可。该写操作



import vlc


It will work

看起来不错



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

通过pip安装不会安装VLC本身,只会安装libvlc绑定的python包装器。要使用它们,您需要安装一个工作正常的VLC。请从www.Videolan.org获取VLC


更多回答

I can confirm that it works for me too. Thank you! Also, to whom it may concern, I downloaded the 64 bit vlc player from get.videolan.org/vlc/3.0.11/win64/vlc-3.0.11-win64.exe

我可以肯定的是,它对我也有效。谢谢!此外,我还从get.videolan.org/vlc/3.0.11/win64/vlc-3.0.11-win64.exe下载了64位VLC播放器

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com