python - 我可以将 libVLC 的 Python 绑定(bind)与 Python 3.x 一起使用吗?

标签 python linux python-3.x vlc libvlc

我想使用 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/

相关文章:

c - C - Unix 中回车键的 Ascii 值

python - 对原始字符串进行编码,以便将其解码为 json

python - 如何将 Python 版本升级到 3.7?

python - 如何制作BeautifulSoup "understand"plus html实体

python - 如何在 OpenCV 中计算焦距?

linux - 启动linux脚本时使用at命令执行minicom脚本时没有出现光标移动功能

linux - 在 fd 上实现的计时器

python - 在 Windows 中设置 python 3 环境的简单方法 : just install from python. org,或者真的会从 miniconda 或类似的东西中受益吗?

Python列表不会在循环中洗牌

python - 如何从 Ubuntu 19.10 卸载 python 3.7?