wzpan / dingdang-robot

🤖 叮当是一款可以工作在 Raspberry Pi 上的中文语音对话机器人/智能音箱项目。
http://dingdang.hahack.com
Other
1.86k stars 535 forks source link

运行报错,ImportError: libpocketsphinx.so.1: cannot open shared object file #95

Closed Cdmoonb closed 6 years ago

Cdmoonb commented 6 years ago

系统:ubuntu16.04LTS python:2.7.12 dingdang.log: 2018-01-04 19:01:54,033 dingdang.py[line:174] ERROR Error occured! Traceback (most recent call last): File "dingdang.py", line 172, in app = Dingdang() File "dingdang.py", line 94, in init stt_passive_engine_class.get_passive_instance(), File "/home/chenpeng/dingdang/client/stt.py", line 59, in get_passive_instance return cls.get_instance('keyword', phrases) File "/home/chenpeng/dingdang/client/stt.py", line 53, in get_instance instance = cls(**config) File "/home/chenpeng/dingdang/client/stt.py", line 110, in init import pocketsphinx as ps ImportError: libpocketsphinx.so.1: cannot open shared object file: No such file or directory

pycharm run:

Exception AttributeError: "'PocketSphinxSTT' object has no attribute '_logfile'" in <bound method PocketSphinxSTT.del of <client.stt.PocketSphinxSTT object at 0x7fe000f58fd0>> ignored

Process finished with exit code 1

代码: /# quirky bug where first import doesn't work

    try:

        import pocketsphinx as ps

    except Exception:
        import pocketsphinx as ps

这里进入exception就弹出进入del程序退出

def del(self):

    os.remove(self._logfile)
wzpan commented 6 years ago

没装好 pocketsphinx ,试过安装对应的 python 库没?

sudo apt-get install python-pocketsphinx 

或者 pypi 的安装方法

# Make sure we have up-to-date versions of pip, setuptools and wheel:
$ pip install --upgrade pip setuptools wheel

$ pip install --upgrade pocketsphinx
Jaylon commented 6 years ago

pi@raspberrypi:~/workspace/dingdang $ cat temp/dingdang.log 2018-01-15 23:53:32,822 dingdang.py[line:175] ERROR Error occured! Traceback (most recent call last): File "dingdang.py", line 173, in app = Dingdang() File "dingdang.py", line 95, in init stt_passive_engine_class.get_passive_instance(), File "/home/pi/workspace/dingdang/client/stt.py", line 66, in get_passive_instance return cls.get_instance('keyword', phrases) File "/home/pi/workspace/dingdang/client/stt.py", line 60, in get_instance instance = cls(**config) File "/home/pi/workspace/dingdang/client/stt.py", line 113, in init import pocketsphinx as ps ImportError: libpocketsphinx.so.1: cannot open shared object file: No such file or directory

pi@raspberrypi:~/workspace/dingdang $ uname -a Linux raspberrypi 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017 armv7l GNU/Linux


遇到同样的问题。执行以下两条命令后,问题依旧没有解决。 $ pip install --upgrade pip setuptools wheel $ pip install --upgrade pocketsphinx

wzpan commented 6 years ago

建议使用镜像安装方式,不同的系统差别太大,难以帮助解决。

Jaylon commented 6 years ago

运行 sudo ldconfig 命令之后,问题解决。

Cdmoonb commented 6 years ago

我重装了系统ubuntu16.04LTS 然后重新按照步骤走了一遍 是成功的 应该是我中间步骤出错了 谢