Gst 的初始化在ubuntu安装的python下工作,而不是由anaconda安装的python:
我写了一个小脚本来说明会发生什么:
$ cat gstinit.py
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst
Gst.init(None)
print("Done!")
以下是使用ubuntu python的结果:
$ /usr/bin/python2.7 gstinit.py
Done!
但只需使用anaconda安装的python
即可:
$ python gstinit.py
** (process:27029): WARNING **: Failed to load shared library 'libgstreamer-1.0.so.0' referenced by the typelib: libiconv.so.2: cannot open shared object file: No such file or directory
Traceback (most recent call last):
File "gstinit.py", line 4, in <module>
Gst.init(None)
gi._error.GError: g-invoke-error-quark: Could not locate gst_init: libiconv.so.2: cannot open shared object file: No such file or directory (1)
搜索失败的库成功:
$ ls -lt $(find /usr -name libgstreamer-1.0.so.0)
lrwxrwxrwx 1 root root 27 sept. 6 15:16 /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 -> libgstreamer-1.0.so.0.803.0
lrwxrwxrwx 1 root root 27 sept. 6 15:12 /usr/lib/i386-linux-gnu/libgstreamer-1.0.so.0 -> libgstreamer-1.0.so.0.803.0
这不是我第一次遇到gstreamer和anaconda的问题。这一次,它遵循conda update
。以下是anaconda下gstreamer的安装包:
$ conda list | grep gst
gst-plugins-base 1.8.0 0 conda-forge
gstreamer 1.8.0 1 conda-forge
答案 0 :(得分:1)
我的解决方案是:
在任何其他包之前安装PyGObject:
conda install -c pkgw pygobject3=3.18.2
答案 1 :(得分:0)
这对我有效https://github.com/conda-forge/gstreamer-feedstock。它使用conda-forge。