如何使用 pip 安装 wit.ai 和 pywit?

如何使用 pip 安装 wit.ai 和 pywit?

Wit.ai 是https://wit.ai/getting-started

安装说明如下:https://wit.ai/docs/python/1.0.0/quickstart

但我无法成功安装它,我尝试过:

alvas@ubi:~$ sudo -H pip install wit
[sudo] password for alvas: 
Collecting wit
  Using cached wit-1.1.tar.gz
Building wheels for collected packages: wit
  Running setup.py bdist_wheel for wit
  Complete output from command /usr/bin/python3 -c "import setuptools;__file__='/tmp/pip-build-hxi3hs02/wit/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmp_2xpbe0opip-wheel-:
  running bdist_wheel
  running build
  Retrieving platform-specific libwit library... libwit-64-linux.a
  running build_ext
  building 'wit' extension
  creating build
  creating build/temp.linux-x86_64-3.4
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -Ilibwit/include -I/usr/include/python3.4m -c pywit.c -o build/temp.linux-x86_64-3.4/pywit.o
  pywit.c:18:18: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
   static PyObject *pywit_close()
                    ^
  pywit.c:57:18: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
   static PyObject *pywit_voice_query_stop()
                    ^
  pywit.c: In function ‘initwit’:
  pywit.c:183:2: warning: implicit declaration of function ‘Py_InitModule’ [-Wimplicit-function-declaration]
    m = Py_InitModule("wit", WitMethods);
    ^
  pywit.c:183:4: warning: assignment makes pointer from integer without a cast [enabled by default]
    m = Py_InitModule("wit", WitMethods);
      ^
  pywit.c:185:3: warning: ‘return’ with no value, in function returning non-void [-Wreturn-type]
     return;
     ^
  creating build/lib.linux-x86_64-3.4
  x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.4/pywit.o -Llibwit/lib -lwit -lrt -lsox -lssl -lcrypto -ldl -lpthread -lrt -lgcc_s -lpthread -lc -lm -o build/lib.linux-x86_64-3.4/wit.cpython-34m.so
  /usr/bin/ld: cannot find -lsox
  collect2: error: ld returned 1 exit status
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for wit
Failed to build wit
Installing collected packages: wit
  Running setup.py install for wit
    Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-hxi3hs02/wit/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ajpcpgli-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'wit' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -Ilibwit/include -I/usr/include/python3.4m -c pywit.c -o build/temp.linux-x86_64-3.4/pywit.o
    pywit.c:18:18: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
     static PyObject *pywit_close()
                      ^
    pywit.c:57:18: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
     static PyObject *pywit_voice_query_stop()
                      ^
    pywit.c: In function ‘initwit’:
    pywit.c:183:2: warning: implicit declaration of function ‘Py_InitModule’ [-Wimplicit-function-declaration]
      m = Py_InitModule("wit", WitMethods);
      ^
    pywit.c:183:4: warning: assignment makes pointer from integer without a cast [enabled by default]
      m = Py_InitModule("wit", WitMethods);
        ^
    pywit.c:185:3: warning: ‘return’ with no value, in function returning non-void [-Wreturn-type]
       return;
       ^
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.4/pywit.o -Llibwit/lib -lwit -lrt -lsox -lssl -lcrypto -ldl -lpthread -lrt -lgcc_s -lpthread -lc -lm -o build/lib.linux-x86_64-3.4/wit.cpython-34m.so
    /usr/bin/ld: cannot find -lsox
    collect2: error: ld returned 1 exit status
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-hxi3hs02/wit/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ajpcpgli-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-hxi3hs02/wit

我怎样才能在 ubuntu 上wit.ai安装?pywit

答案1

/usr/bin/ld: cannot find -lsox

正如第一条评论所提到的,您缺少 libsox。

相关内容