我想使用 libVLC 为 Linux 构建视频调度程序。 PythonBinding libVLC 的 wiki 指出它可以与大于 2.5 的 Python 版本一起使用。但是,我找不到任何信息明确说明它适用于或不适用于 Python 3.x。
最佳答案
您链接的代码包含一个 compatibility layer检查 python 版本并设置一些变量以使代码在 Python 2 和 Python 3 中工作:
if sys.version_info[0] > 2:
str = str
unicode = str
bytes = bytes
basestring = (str, bytes)
PYTHON3 = True
...
else:
str = str
unicode = unicode
bytes = str
basestring = basestring
PYTHON3 = False
...
这看起来像是一个很好的暗示,表明 Python 2 和 3 应该同时受到支持。
(请注意,许多库使用名为 six
的标准帮助程序库来保持代码多语言,而不是像 vlc.py
那样手动执行此操作,但我理解该库的作者想要避免外部依赖。)
关于python - 我可以将 libVLC 的 Python 绑定(bind)与 Python 3.x 一起使用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48261882/