MacOS 上的 pip 包安装失败并显示“错误:命令‘gcc’失败,退出状态为 1”

时间:2021-03-18 14:19:44

标签: python xcode gcc pip

我安装了 PdfParser 并在我的 Python3.7 环境中工作。当系统提示我安装 xcode 更新时,我正在下载另一个包。

紧接着,PdfParser 无法运行,所以我卸载了它并尝试重新安装。现在,我无法再次下载它:

python3.7 -m pip install git+https://github.com/izderadicka/pdfparser --user

unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT {
              ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2564:7: note: candidate template ignored: could not match 'auto_ptr<type-parameter-0-0>' against 'GlobalParams *'
          operator=(auto_ptr<_Up> __p) {
          ^
    2 warnings and 11 errors generated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/qn/randomstring/T/pip-req-build-1u2_2dh6/setup.py'"'"'; __file__='"'"'/private/var/folders/qn/randomstring/T/pip-req-build-1u2_2dh6/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/qn/randomstring/T/pip-record-randomstring/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/dev/Library/Python/3.7/include/python3.7m/pdfparser Check the logs for full command output.

我不能肯定,但我认为更新 xcode 确实改变了 clang 和 gcc 在我的计算机上的运行方式。我已经卸载并重新安装了 xcode 12.4 并安装了 xcode-select。运行命令 gcc 会给我 clang: error: no input files

运行 pip3 install git+https://github.com/izderadicka/pdfparser 给了我一个稍微不同的错误,

error: command '/usr/bin/clang' failed with exit code 1

我使用的是 MacOS Catalina。我在上面的输出中用“randomstring”替换了像“u19ks74lm”这样的随机字符串。

0 个答案:

没有答案