如何忽略pip中的编译器标志?

时间:2017-12-21 22:08:41

标签: python gcc pip reinforcement-learning

我试图安装mujoco-py,当我在我的maxOS 10.12中使用python 3.5在anaconda中尝试pip install mujoco_py时,我得到了

  /usr/local/bin/gcc-7 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/Shangtong/anaconda2/envs/Python3.5/include -I/Users/Shangtong/anaconda2/envs/Python3.5/include -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -DONMAC -Imujoco_py -I/private/var/folders/6j/gtq1cx25611ck3bft9rnfxkh0000gn/T/pip-build-3r460esi/mujoco-py/mujoco_py -I/Users/Shangtong/.mujoco/mjpro150/include -I/Users/Shangtong/anaconda2/envs/Python3.5/lib/python3.5/site-packages/numpy/core/include -I/Users/Shangtong/anaconda2/envs/Python3.5/include/python3.5m -c /private/var/folders/6j/gtq1cx25611ck3bft9rnfxkh0000gn/T/pip-build-3r460esi/mujoco-py/mujoco_py/cymj.c -o /private/var/folders/6j/gtq1cx25611ck3bft9rnfxkh0000gn/T/pip-build-3r460esi/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/temp.macosx-10.6-x86_64-3.5/private/var/folders/6j/gtq1cx25611ck3bft9rnfxkh0000gn/T/pip-build-3r460esi/mujoco-py/mujoco_py/cymj.o -fopenmp -w
  cc1: error: -Werror=unused-command-line-argument-hard-error-in-future: no option -Wunused-command-line-argument-hard-error-in-future
  cc1: error: -Werror=unused-command-line-argument-hard-error-in-future: no option -Wunused-command-line-argument-hard-error-in-future
  cc1: error: -Werror=unused-command-line-argument-hard-error-in-future: no option -Wunused-command-line-argument-hard-error-in-future
  error: command '/usr/local/bin/gcc-7' failed with exit status 1

我必须安装gcc,因为它不接受clang。看来gcc并没有忽略这个未知的旗帜。我试过了

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install mujoco_py

但它没有帮助。 gcc有什么办法可以忽略这个未知的旗帜吗?

1 个答案:

答案 0 :(得分:0)

我终于找到了解决方案。 首先通过brew install clang-omp安装clang-omp。然后通过sudo ln -s /usr/local/bin/clang-omp /usr/local/bin/gcc-7将clang-omp链接到gcc-7。然后你应该能够运行mujoco151。请注意,您可能还需要brew uninstall glfw来解决冲突。