简体   繁体   中英

python3.x importing gi... the path of gi package

I built the gst-python with gstreamer built by myself using cerbero... When importing gi, there is some error like below:

Traceback (most recent call last):
  File "check.py", line 2, in <module>
    gi.require_version('Gst', '1.0')
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 102, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gst not available

By the way, this code works well on my another ubuntu. so I printed out the path of gi using code added on each ubuntu, then the output were different like this.

Works well.

>>> gi.__file__
'/usr/local/lib/python3.4/dist-packages/gi/__init__.py'

Doesn't work

>>> gi.__file__
'/usr/lib/python3/dist-packages/gi/__init__.py'

I not sure this difference of path cause the problem. But I wonder how can I control the install path of gi/override...

Please understand my poor question. I am a newbie on gst-python and python...

import gi
print(gi.__file__)
gi.require_version('Gst', '1.0')

I uninstalled and reinstalled gst library and the error disappeared:

conda install -c conda-forge gst-python

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM