Mac平台GStreamer插件报错:找不到pocketsphinx插件求助
Let's break down what's going wrong and fix this step by step:
First, a critical mistake in your path setup
The pocketsphinx.so in your Python site-packages directory is the Python binding for pocketsphinx, not the GStreamer plugin you need. GStreamer plugins are separate shared library files (.dylib on macOS, .so on Linux) named like libgstpocketsphinx.dylib — that's what we need to locate.
Step 1: Check if the GStreamer pocketsphinx plugin is actually installed
First, search your system to confirm the plugin exists. Run this command in your terminal:
find /usr/local -name "*gstpocketsphinx*"
- If no results show up: You haven't installed the GStreamer pocketsphinx plugin yet. The standard
cmu-pocketsphinxpackage doesn't include this plugin — you need to install the GStreamer-specific version. For Homebrew users, try recompilinggst-plugins-goodwith pocketsphinx support:
(Note: Some newer Homebrew versions have removed build options, so you might need to compilebrew reinstall gst-plugins-good --with-pocketsphinxgst-plugins-goodfrom source with pocketsphinx enabled if this flag doesn't work.)
Step 2: Set the correct GST_PLUGIN_PATH
Once you find the plugin file (e.g., at /usr/local/lib/gstreamer-1.0/libgstpocketsphinx.dylib), the path you need to set is the directory containing this file, not the file itself.
For example:
# If the plugin is in /usr/local/lib/gstreamer-1.0/ export GST_PLUGIN_PATH=/usr/local/lib/gstreamer-1.0/ # If it's in a Homebrew Cellar subdirectory (adjust the version number to match yours) export GST_PLUGIN_PATH=/usr/local/Cellar/gst-plugins-good/1.14.4/lib/gstreamer-1.0/
If you have multiple plugin directories, separate them with a colon:
export GST_PLUGIN_PATH=/usr/local/lib/gstreamer-1.0/:/usr/local/Cellar/gstreamer/1.14.4/lib/gstreamer-1.0/
Step 3: Verify your setup
Run this command to confirm GStreamer is looking in the right places:
gst-inspect-1.0 --print-plugin-path
You should see your specified path in the output. Then try running:
gst-inspect-1.0 pocketsphinx
This should now detect the plugin if everything is set correctly.
Clean up unnecessary steps
Copying those .pc files to your Python site-packages was unnecessary — those are used for compiling software, not running GStreamer plugins. You can safely delete them to avoid confusion:
rm /usr/local/Cellar/cmu-pocketsphinx/0.8/lib/python2.7/site-packages/gstreamer-*.pc
内容的提问来源于stack exchange,提问作者Cindy

