cannot import gi module python 3.6 on mac

偶尔善良 提交于 2019-12-20 03:23:28

问题


I am integrating gstreamer and pocketsphinx on mac using python 3.6; however, the first line of code, from gi import pygtkcompat, raises an error. The command:

python3 demoapp_chinese.py

returns

  • Traceback (most recent call last):
  • File "demoapp_chinese.py", line 1, in
  • from gi import pygtkcompat
  • ModuleNotFoundError: No module named 'gi'

Here's how I install pygobject:

brew install pygobject3

And when I try to get more info. I execute

brew info pygobject3

which returns

  • pygobject3: stable 3.30.4 (bottled)
  • GNOME Python bindings (based on GObject Introspection)
  • https://wiki.gnome.org/Projects/PyGObject
  • /usr/local/Cellar/pygobject3/3.30.4 (69 files, 1.6MB) *
  • Poured from bottle on 2019-02-04 at 17:21:21
  • From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/pygobject3.rb (here I only post the first few couple of lines)

For the python info,

which python3

returns

/usr/local/bin/python3

Besides,

echo $PYTHONPATH

returns

/usr/local/lib/python3.6/site-packages

echo $PATH

returns

/Users/cindy/bin:/usr/local/bin/python3.6:/usr/local/lib/python3.6/site-packages:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public

Lastly, I don't know if this is normal, when I run

which pygobject3

NOTHING returns on the terminal.

Please help, thanks. If you need any extra info. to help me, please let me know.

来源:https://stackoverflow.com/questions/54515203/cannot-import-gi-module-python-3-6-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!