我可以将 libVLC 的 Python 绑定与 Python 3.x 一起使用吗?

Can I use libVLC's Python bindings with Python 3.x?

我想使用 libVLC 为 Linux 构建视频调度程序。 libVLC 的 PythonBinding wiki 指出它可以与 Python 大于 2.5 的版本一起使用。但是,我找不到任何信息明确说明它适用于或不适用于 Python 3.x.

您链接的代码包含一个 compatibility layer,它检查 python 版本并设置一些变量以使代码在 Python 2 in 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 那样手动执行此操作,但我理解该库的作者想要避免外部依赖项。)