我正在尝试使用GTK和gstreamer制作一个简单的python程序。为此,我需要GES(Gstreamer编辑服务),但我似乎无法正确安装我需要的依赖项。
到目前为止,我已经安装了(sudo apt-get install...
)gstreamer1.0,它工作正常。我用libges-1.0-dev和libges-1.0-0做了同样的事情。但是,当我尝试在我的python脚本中导入GES(from gi.repository import GES
)时,我收到以下错误:
ImportError: cannot import name GES, introspection typelib not found
我猜我错过了一些关于如何实际安装软件包的内容,但似乎我不太了解python和Linux以及我应该做的事情。
答案 0 :(得分:0)
运行以下内容以验证所有先决条件:
def Prerequisites():
import re
from subprocess import check_output, CalledProcessError, STDOUT
Desired = {'u':'Unknow', 'i':'Install', 'r':'Remove', 'h':'Hold'}
Status = {'n':'Not', 'i':'Inst', 'c':'Conf-files', 'u':'Unpacked', 'f':'halF-conf', 'h':'Half-inst', 'w':'trig-aWait', 't':'Trig-pend'}
re_pip3 = re.compile('(.+?): (.*?)\n', re.S + re.MULTILINE)
re_dpkg = re.compile('(.+?)\n', re.S + re.MULTILINE)
for n, package in enumerate(["python-gst-1.0", "python-gst-1.0", "gir1.2-gstreamer-1.0", "gir1.2-gst-plugins-base-1.0",
"gstreamer1.0-plugins-good", "gstreamer1.0-plugins-ugly", "gstreamer1.0-tools"]):
try:
if n in [0]:
output = check_output("pip3 show {}".format(package), shell=True, stderr=STDOUT).decode()
print('OK: Name: {s[Name]}, Version: {s[Version]}, Location: {s[Location]}'.
format(s=dict(re_pip3.findall(output))))
else:
output = check_output("dpkg -l {}".format(package), shell=True, stderr=STDOUT).decode()
for p in re_dpkg.findall(output)[6:]:
if p[0:2] == 'ii':
print('OK: {} - Desired:{},\tStatus:{}'.format(p, Desired[p[0]], Status[p[1]]))
else:
print('[FAIL] {} - Desired:{},\tStatus:{}'.format(p, Desired[p[0]], Status[p[1]]))
except CalledProcessError as exp:
print('[FAIL] {} - CalledProcessError: {}'.format(package, exp.output.decode()[:-1] or exp))
请确认您要执行以下操作:Simple
依赖关系:
* GStreamer核心
* gst-plugins-base
GStreamervModules
Installing from local archives
这应该没问题:“唯一相关的结果似乎是(gstreamer-player)”
尝试以下方法:
from gsp import GstreamerPlayer
player = GstreamerPlayer(None)
player.queue("/path/to/audio.mp3")
project site给出了这个:
先决条件
于Debian / Ubuntu / Rasbian:sudo apt-get install python-gst-1.0 \ gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0 \ gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly \ gstreamer1.0-tools