问题
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