问题
I can't get the ffprobe package to work in Python 3.6. I installed it using pip, but when I type import ffprobe
it says
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'
The __init__.py file contains just the single line
from ffprobe import FFProbe
.sys.path
includes 'C:\Python\Python36\lib\site-packages', which is where the ffprobe directory is located.Installing and importing the package works in Python 2.7 with no problems. But I would like to use it in Python 3, even if that means making manual changes to the .py files. (There is no documentation that says the package only works in Python 2.)
Can anyone help?
回答1:
Use this ffprobe package instead for Python3. Works for me: pip install ffprobe-python
回答2:
The solution is that the ffprobe package only works with Python 2.
In Python 3 the import statement would need to be from .ffprobe ...
, but just changing that is not sufficient as there are other lines that only work in Python 2 as well.
Thanks to Rawing.
来源:https://stackoverflow.com/questions/44227378/importerror-cannot-import-name-ffprobe