导入错误:无法导入名称'FFProbe'。

问题描述 投票:0回答:1

我拿不到 ffprobe包 在 Python 3.6 中工作。我使用 pip 安装了它,但当我输入 import ffprobe 它说

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python\Python36\lib\site-packages\ffprobe\__init__.py", line 1, in <module>
  from ffprobe import FFProbe
ImportError: cannot import name 'FFProbe'
  • __init__.py文件只包含了以下一行 from ffprobe import FFProbe.

  • sys.path 包括'C:\Python\Python36\lib\site-packages',这就是ffprobe目录的位置。

  • 在Python 2.7中安装和导入这个包没有问题。但我想在 Python 3 中使用它,即使这意味着要对 .py 文件进行手动修改。(没有文档说这个包只能在 Python 2 中使用。)

有谁能帮忙吗?

python rtmp
1个回答
2
投票

用这个ffprobe包代替Python3。对我来说很有用。pip install ffprobe-python


1
投票

解决方法是 ffprobe 包只适用于 Python 2.

在Python 3中,导入语句需要是 from .ffprobe ...但仅仅改变这一点是不够的,因为还有其他的线路也只能在Python 2中使用。

感谢Rawing。

© www.soinside.com 2019 - 2024. All rights reserved.