安装Google Assistant SDK示例

时间:2017-12-27 04:13:50

标签: python python-3.x raspberry-pi3 google-assistant-sdk cffi

我正在尝试使用this指南为我的Raspberry Pi 3B添加语音识别功能。

我已经将它发送到this部分,直到下面的命令通过ssh并获得某种CFFI缺失错误。我重复了上面的网页用python3替换python并返回相同的错误。

注意:底部 内的内容是红色错误。

(env) pi@rpi-screen:~ $ python -m pip install --upgrade google-assistant-sdk[samples]
Collecting google-assistant-sdk[samples]
  Using cached google_assistant_sdk-0.4.0-py2.py3-none-any.whl
Requirement already up-to-date: google-auth-oauthlib[tool]>=0.1.0 in ./env/lib/python2.7/site-packages (from google-assistant-sdk[samples])
Requirement already up-to-date: google-assistant-grpc==0.1.0; extra == "samples" in ./env/lib/python2.7/site-packages (from google-assistant-sdk[samples])
Collecting sounddevice<0.4,>=0.3.7; extra == "samples" (from google-assistant-sdk[samples])
  Using cached sounddevice-0.3.10-py2.py3-none-any.whl
Requirement already up-to-date: futures<4,>=3.1.1; extra == "samples" in ./env/lib/python2.7/site-packages (from google-assistant-sdk[samples])
Requirement already up-to-date: click<7,>=6.7; extra == "samples" in ./env/lib/python2.7/site-packages (from google-assistant-sdk[samples])
Requirement already up-to-date: urllib3[secure]<2,>=1.21; extra == "samples" in ./env/lib/python2.7/site-packages (from google-assistant-sdk[samples])
Collecting tenacity<5,>=4.1.0; extra == "samples" (from google-assistant-sdk[samples])
  Using cached tenacity-4.8.0-py2.py3-none-any.whl
Collecting google-auth (from google-auth-oauthlib[tool]>=0.1.0->google-assistant-sdk[samples])
  Using cached google_auth-1.2.1-py2.py3-none-any.whl
Requirement already up-to-date: requests-oauthlib>=0.7.0 in ./env/lib/python2.7/site-packages (from google-auth-oauthlib[tool]>=0.1.0->google-assistant-sdk[samples])
Requirement already up-to-date: googleapis-common-protos>=1.5.2 in ./env/lib/python2.7/site-packages (from google-assistant-grpc==0.1.0; extra == "samples"->google-assistant-sdk[samples])
Requirement already up-to-date: grpcio>=1.3.5 in ./env/lib/python2.7/site-packages (from google-assistant-grpc==0.1.0; extra == "samples"->google-assistant-sdk[samples])
Collecting CFFI>=1.0 (from sounddevice<0.4,>=0.3.7; extra == "samples"->google-assistant-sdk[samples])
  Using cached cffi-1.11.2.tar.gz
Requirement already up-to-date: idna>=2.0.0; python_version <= "2.7" and extra == "secure" in ./env/lib/python2.7/site-packages (from urllib3[secure]<2,>=1.21; extra == "samples"->google-assistant-sdk[samples])
Collecting pyOpenSSL>=0.14; python_version <= "2.7" and extra == "secure" (from urllib3[secure]<2,>=1.21; extra == "samples"->google-assistant-sdk[samples])
  Using cached pyOpenSSL-17.5.0-py2.py3-none-any.whl
Collecting cryptography>=1.3.4; python_version <= "2.7" and extra == "secure" (from urllib3[secure]<2,>=1.21; extra == "samples"->google-assistant-sdk[samples])
  Using cached cryptography-2.1.4.tar.gz
Requirement already up-to-date: certifi; extra == "secure" in ./env/lib/python2.7/site-packages (from urllib3[secure]<2,>=1.21; extra == "samples"->google-assistant-sdk[samples])
Collecting ipaddress; python_version <= "2.7" and extra == "secure" (from urllib3[secure]<2,>=1.21; extra == "samples"->google-assistant-sdk[samples])
  Using cached ipaddress-1.0.19.tar.gz
Requirement already up-to-date: six>=1.9.0 in ./env/lib/python2.7/site-packages (from tenacity<5,>=4.1.0; extra == "samples"->google-assistant-sdk[samples])
Collecting monotonic>=0.6 (from tenacity<5,>=4.1.0; extra == "samples"->google-assistant-sdk[samples])
  Using cached monotonic-1.4-py2.py3-none-any.whl
Requirement already up-to-date: pyasn1>=0.1.7 in ./env/lib/python2.7/site-packages (from google-auth->google-auth-oauthlib[tool]>=0.1.0->google-assistant-sdk[samples])
Requirement already up-to-date: pyasn1-modules>=0.0.5 in ./env/lib/python2.7/site-packages (from google-auth->google-auth-oauthlib[tool]>=0.1.0->google-assistant-sdk[samples])
Requirement already up-to-date: rsa>=3.1.4 in ./env/lib/python2.7/site-packages (from google-auth->google-auth-oauthlib[tool]>=0.1.0->google-assistant-sdk[samples])
Requirement already up-to-date: cachetools>=2.0.0 in ./env/lib/python2.7/site-packages (from google-auth->google-auth-oauthlib[tool]>=0.1.0->google-assistant-sdk[samples])
Requirement already up-to-date: oauthlib>=0.6.2 in ./env/lib/python2.7/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib[tool]>=0.1.0->google-assistant-sdk[samples])
Collecting requests>=2.0.0 (from requests-oauthlib>=0.7.0->google-auth-oauthlib[tool]>=0.1.0->google-assistant-sdk[samples])
  Using cached requests-2.18.4-py2.py3-none-any.whl
Requirement already up-to-date: protobuf>=3.0.0 in ./env/lib/python2.7/site-packages (from googleapis-common-protos>=1.5.2->google-assistant-grpc==0.1.0; extra == "samples"->google-assistant-sdk[samples])
Requirement already up-to-date: enum34>=1.0.4 in ./env/lib/python2.7/site-packages (from grpcio>=1.3.5->google-assistant-grpc==0.1.0; extra == "samples"->google-assistant-sdk[samples])
Requirement already up-to-date: pycparser in ./env/lib/python2.7/site-packages (from CFFI>=1.0->sounddevice<0.4,>=0.3.7; extra == "samples"->google-assistant-sdk[samples])
Requirement already up-to-date: asn1crypto>=0.21.0 in ./env/lib/python2.7/site-packages (from cryptography>=1.3.4; python_version <= "2.7" and extra == "secure"->urllib3[secure]<2,>=1.21; extra == "samples"->google-assistant-sdk[samples])
Requirement already up-to-date: chardet<3.1.0,>=3.0.2 in ./env/lib/python2.7/site-packages (from requests>=2.0.0->requests-oauthlib>=0.7.0->google-auth-oauthlib[tool]>=0.1.0->google-assistant-sdk[samples])
Requirement already up-to-date: setuptools in ./env/lib/python2.7/site-packages (from protobuf>=3.0.0->googleapis-common-protos>=1.5.2->google-assistant-grpc==0.1.0; extra == "samples"->google-assistant-sdk[samples])
Installing collected packages: CFFI, sounddevice, monotonic, tenacity, google-assistant-sdk, google-auth, ipaddress, cryptography, pyOpenSSL, requests
  Running setup.py install for CFFI ... error
    Complete output from command /home/pi/env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9p5OeY/CFFI/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-CzEVHY-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/pi/env/include/site/python2.7/CFFI:
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-armv7l-2.7
    creating build/lib.linux-armv7l-2.7/cffi
    copying cffi/ffiplatform.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/commontypes.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/model.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/error.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/lock.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/api.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/backend_ctypes.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/__init__.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/verifier.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/cparser.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/recompiler.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/vengine_gen.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/cffi_opcode.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/setuptools_ext.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/vengine_cpy.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/_cffi_include.h -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/parse_c_type.h -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/_embedding.h -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/_cffi_errors.h -> build/lib.linux-armv7l-2.7/cffi
    running build_ext
    building '_cffi_backend' extension
    creating build/temp.linux-armv7l-2.7
    creating build/temp.linux-armv7l-2.7/c
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-armv7l-2.7/c/_cffi_backend.o
    c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
     #include <ffi.h>
                     ^
    compilation terminated.
    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
Command "/home/pi/env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9p5OeY/CFFI/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-CzEVHY-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/pi/env/include/site/python2.7/CFFI" failed with error code 1 in /tmp/pip-build-9p5OeY/CFFI/
(env) pi@rpi-screen:~ $

1 个答案:

答案 0 :(得分:0)

确保安装样本dependencies

sudo apt-get install portaudio19-dev libffi-dev libssl-dev