【问题标题】:error: command 'gcc' failed with exit status 1 fatal error: 'vector' file not found错误:命令“gcc”失败,退出状态为 1 致命错误:找不到“向量”文件
【发布时间】:2019-05-30 08:09:00
【问题描述】:

我运行 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 编译?我该怎么做?

【问题讨论】:

  • GCC 有时只附带 C。这发生在我的 ubuntu 机器上。是否安装了 c++ for gcc?

标签: gcc pip annoy


【解决方案1】:

我应该用 g++ 而不是 gcc 编译:显然是的,#include &lt;vector&gt; 通常是 C++,而不是 C

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-30
    • 1970-01-01
    • 2016-01-08
    • 2013-11-26
    • 2011-11-11
    相关资源
    最近更新 更多