gcc:错误尝试执行'cc1plus':execvp:没有这样的文件或目录

cjm*_*671 17 python gcc

我正在尝试安装这个需要编译的python模块(在Ubuntu 16.04上).我正在努力弄清楚究竟是什么导致它失速; 我错过了什么?

(xenial)chris@localhost:~$ pip install swigibpy
Collecting swigibpy
  Using cached swigibpy-0.4.1.tar.gz
Building wheels for collected packages: swigibpy
  Running setup.py bdist_wheel for swigibpy ... error
  Complete output from command /home/chris/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-162vhh_i/swigibpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmptqb6ctskpip-wheel- --python-tag cp35:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.5
  copying swigibpy.py -> build/lib.linux-x86_64-3.5
  running build_ext
  building '_swigibpy' extension
  creating build/temp.linux-x86_64-3.5
  creating build/temp.linux-x86_64-3.5/IB
  creating build/temp.linux-x86_64-3.5/IB/PosixSocketClient
  gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DIB_USE_STD_STRING=1 -IIB -IIB/PosixSocketClient -IIB/Shared -I/home/chris/anaconda3/include/python3.5m -c IB/PosixSocketClient/EClientSocketBase.cpp -o build/temp.linux-x86_64-3.5/IB/PosixSocketClient/EClientSocketBase.o -Wno-switch
  gcc: error trying to exec 'cc1plus': execvp: No such file or directory
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for swigibpy
  Running setup.py clean for swigibpy
Failed to build swigibpy
Installing collected packages: swigibpy
  Running setup.py install for swigibpy ... error
    Complete output from command /home/chris/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-162vhh_i/swigibpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-yv9u0wok-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.5
    copying swigibpy.py -> build/lib.linux-x86_64-3.5
    running build_ext
    building '_swigibpy' extension
    creating build/temp.linux-x86_64-3.5
    creating build/temp.linux-x86_64-3.5/IB
    creating build/temp.linux-x86_64-3.5/IB/PosixSocketClient
    gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DIB_USE_STD_STRING=1 -IIB -IIB/PosixSocketClient -IIB/Shared -I/home/chris/anaconda3/include/python3.5m -c IB/PosixSocketClient/EClientSocketBase.cpp -o build/temp.linux-x86_64-3.5/IB/PosixSocketClient/EClientSocketBase.o -Wno-switch
    gcc: error trying to exec 'cc1plus': execvp: No such file or directory
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/home/chris/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-162vhh_i/swigibpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-yv9u0wok-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-162vhh_i/swigibpy/
Run Code Online (Sandbox Code Playgroud)

Gle*_*son 30

以下对我有用:

sudo apt-get install g++
Run Code Online (Sandbox Code Playgroud)

  • 另外,确保 gcc 和 g++ 具有相同的版本。 (2认同)

小智 17

这些例程命令一次又一次地为我节省了这些错误:

sudo apt update
sudo apt upgrade
sudo apt install gcc python3-dev python3-pip libxml2-dev libxslt1-dev zlib1g-dev g++
Run Code Online (Sandbox Code Playgroud)

希望它有效.

  • 只有 g++ 部分是必要的。 (8认同)

Sou*_*ain 13

这个链接帮助我解决了这个问题。

您需要运行以下命令才能安装 g++

yum install gcc-c++

  • @emher 仍然对来到这里的其他人有帮助,因为标题或标签没有提到 Ubuntu。 (2认同)

dsa*_*laj 8

对于 Conda 环境,以下内容应该有所帮助:

conda install gcc_linux-64
conda install gxx_linux-64
Run Code Online (Sandbox Code Playgroud)

请参阅此处有关此问题的旧讨论。


Mik*_*che 7

这帮助我在 Docker alpine 上构建 Python greenlet

apk add g++
Run Code Online (Sandbox Code Playgroud)