错误:命令' gcc'安装psutil时退出状态失败

时间:2018-04-27 12:33:38

标签: python gcc pip clang osx-yosemite

在安装一些python模块的过程中,我不得不安装psutil,但我一直在遇到与gcc相关的问题。这是安装中堆栈跟踪的一部分:

building 'psutil._psutil_osx' extension
    creating build/temp.macosx-10.5-x86_64-2.7
    creating build/temp.macosx-10.5-x86_64-2.7/psutil
    creating build/temp.macosx-10.5-x86_64-2.7/psutil/arch
    creating build/temp.macosx-10.5-x86_64-2.7/psutil/arch/osx
    gcc -fno-strict-aliasing -I/Users/jspacman/miniconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=545 -DPSUTIL_OSX=1 -I/Users/jspacman/miniconda/include/python2.7 -c psutil/_psutil_common.c -o build/temp.macosx-10.5-x86_64-2.7/psutil/_psutil_common.o
    gcc -fno-strict-aliasing -I/Users/jspacman/miniconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=545 -DPSUTIL_OSX=1 -I/Users/jspacman/miniconda/include/python2.7 -c psutil/_psutil_posix.c -o build/temp.macosx-10.5-x86_64-2.7/psutil/_psutil_posix.o
    gcc -fno-strict-aliasing -I/Users/jspacman/miniconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=545 -DPSUTIL_OSX=1 -I/Users/jspacman/miniconda/include/python2.7 -c psutil/_psutil_osx.c -o build/temp.macosx-10.5-x86_64-2.7/psutil/_psutil_osx.o
    In file included from /usr/include/dispatch/dispatch.h:51:0,
                     from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
                     from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
                     from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
                     from psutil/_psutil_osx.c:36:
    /usr/include/dispatch/object.h:143:15: error: expected identifier or ‘(’ before ‘^’ token
     typedef void (^dispatch_block_t)(void);
                   ^
    /usr/include/dispatch/object.h:362:3: error: unknown type name ‘dispatch_block_t’
       dispatch_block_t notification_block);
       ^
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/Users/jspacman/miniconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/8q/bdwk8l_j663ckm6n1c0bvvym0000gp/T/pip-install-YVhYLX/psutil/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/8q/bdwk8l_j663ckm6n1c0bvvym0000gp/T/pip-record-wzO8vF/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/8q/bdwk8l_j663ckm6n1c0bvvym0000gp/T/pip-install-YVhYLX/psutil/

其他一些信息:

$ which gcc
/Users/jspacman/anaconda/bin/gcc

$ gcc --version
gcc (GCC) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ python -V
Python 2.7.13 :: Anaconda custom (x86_64)

pip --version
pip 10.0.1 from /Users/jspacman/miniconda/lib/python2.7/site-packages/pip (python 2.7)

我猜我的gcc搞砸了。我在相关问题中关注了answer,对dispatch/object.hAvailability.h进行了更改,但仍然收到了相同的错误消息。

0 个答案:

没有答案