1

我运行 pip install annoy 并收到以下错误:

Collecting annoy
  Using cached https://files.pythonhosted.org/packages/b5/28/f8ce7400344090bb5cfa1c9fae3fdb03b9438db082d458686442633d82a3/annoy-1.15.0.tar.gz
Building wheels for collected packages: annoy
  Running setup.py bdist_wheel for annoy ... error
  Complete output from command /anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/yp/4w8nvxls4y99r68kpxzzwdl00000gn/T/pip-build-h3hirwtn/annoy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/yp/4w8nvxls4y99r68kpxzzwdl00000gn/T/tmpdqliidvopip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.6-x86_64-3.6
  creating build/lib.macosx-10.6-x86_64-3.6/annoy
  copying annoy/__init__.py -> build/lib.macosx-10.6-x86_64-3.6/annoy
  running build_ext
  building 'annoy.annoylib' extension
  creating build/temp.macosx-10.6-x86_64-3.6
  creating build/temp.macosx-10.6-x86_64-3.6/src
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -I/anaconda3/include/python3.6m -c src/annoymodule.cc -o build/temp.macosx-10.6-x86_64-3.6/src/annoymodule.o -O3 -ffast-math -fno-associative-math -march=native
  warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
  In file included from src/annoymodule.cc:15:
  src/annoylib.h:49:10: fatal error: 'vector' file not found
  #include <vector>
           ^~~~~~~~
  1 warning and 1 error generated.
  error: command 'gcc' failed with exit status 1

通过阅读其他 stackoverflow 答案,我应该使用 g++ 而不是 gcc 进行编译?我怎么做?

4

1 回答 1

1

我应该用 g++ 而不是 gcc 编译:显然是的,#include <vector>通常是 C++,而不是 C

安装 g++ 的方式取决于您使用的平台/操作系统

于 2019-01-03T18:23:20.810 回答