psutil是一个特别好用来检查系统资源的一个包, 但是 在Mac安装却总是报错

查看监控系统脚本, 点这里

mac系统版本: Macos Mojave 10.14.3

报错信息如下:

WARNING: The directory '/Users/msw/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/Users/msw/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting psutil
Downloading https://files.pythonhosted.org/packages/03/9a/95c4b3d0424426e5fd94b5302ff74cea44d5d4f53466e1228ac8e73e14b4/psutil-5.6.5.tar.gz (447kB)
|████████████████████████████████| 450kB 153kB/s
Building wheels for collected packages: psutil
Building wheel for psutil (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-c9s3nce8/psutil/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-c9s3nce8/psutil/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 /private/tmp/pip-wheel-v0_0pfgx --python-tag cp36
cwd: /private/tmp/pip-install-c9s3nce8/psutil/
Complete output (106 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.6-intel-3.6
creating build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_pswindows.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_common.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/__init__.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_psosx.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_psbsd.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_psaix.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_pslinux.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_compat.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_psposix.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_pssunos.py -> build/lib.macosx-10.6-intel-3.6/psutil
creating build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/runner.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/__init__.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_process.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_system.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/__main__.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
running build_ext
building 'psutil._psutil_osx' extension
creating build/temp.macosx-10.6-intel-3.6
creating build/temp.macosx-10.6-intel-3.6/psutil
creating build/temp.macosx-10.6-intel-3.6/psutil/arch
creating build/temp.macosx-10.6-intel-3.6/psutil/arch/osx
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=565 -DPSUTIL_OSX=1 -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c psutil/_psutil_common.c -o build/temp.macosx-10.6-intel-3.6/psutil/_psutil_common.o
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=565 -DPSUTIL_OSX=1 -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c psutil/_psutil_posix.c -o build/temp.macosx-10.6-intel-3.6/psutil/_psutil_posix.o
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=565 -DPSUTIL_OSX=1 -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c psutil/_psutil_osx.c -o build/temp.macosx-10.6-intel-3.6/psutil/_psutil_osx.o
In file included from psutil/_psutil_osx.c:36:
In file included from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:
In file included from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:
/usr/local/include/Block.h:16:3: error: Never include this file directly. Use <lzma.h> instead.
# error Never include this file directly. Use <lzma.h> instead.
^
/usr/local/include/Block.h:93:2: error: unknown type name 'lzma_check'
lzma_check check;
^
/usr/local/include/Block.h:148:2: error: unknown type name 'lzma_vli'
lzma_vli compressed_size;
^
/usr/local/include/Block.h:172:2: error: unknown type name 'lzma_vli'
lzma_vli uncompressed_size;
^
/usr/local/include/Block.h:200:2: error: unknown type name 'lzma_filter'
lzma_filter *filters;
^
/usr/local/include/Block.h:217:20: error: use of undeclared identifier 'LZMA_CHECK_SIZE_MAX'
uint8_t raw_check[LZMA_CHECK_SIZE_MAX];
^
/usr/local/include/Block.h:231:2: error: unknown type name 'lzma_vli'
lzma_vli reserved_int3;
^
/usr/local/include/Block.h:232:2: error: unknown type name 'lzma_vli'
lzma_vli reserved_int4;
^
/usr/local/include/Block.h:233:2: error: unknown type name 'lzma_vli'
lzma_vli reserved_int5;
^
/usr/local/include/Block.h:234:2: error: unknown type name 'lzma_vli'
lzma_vli reserved_int6;
^
/usr/local/include/Block.h:235:2: error: unknown type name 'lzma_vli'
lzma_vli reserved_int7;
^
/usr/local/include/Block.h:236:2: error: unknown type name 'lzma_vli'
lzma_vli reserved_int8;
^
/usr/local/include/Block.h:237:2: error: unknown type name 'lzma_reserved_enum'
lzma_reserved_enum reserved_enum1;
^
/usr/local/include/Block.h:238:2: error: unknown type name 'lzma_reserved_enum'
lzma_reserved_enum reserved_enum2;
^
/usr/local/include/Block.h:239:2: error: unknown type name 'lzma_reserved_enum'
lzma_reserved_enum reserved_enum3;
^
/usr/local/include/Block.h:240:2: error: unknown type name 'lzma_reserved_enum'
lzma_reserved_enum reserved_enum4;
^
/usr/local/include/Block.h:261:2: error: unknown type name 'lzma_bool'
lzma_bool ignore_check;
^
/usr/local/include/Block.h:263:2: error: unknown type name 'lzma_bool'
lzma_bool reserved_bool2;
^
/usr/local/include/Block.h:264:2: error: unknown type name 'lzma_bool'
lzma_bool reserved_bool3;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
error: command '/usr/bin/clang' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for psutil
Running setup.py clean for psutil
Failed to build psutil
Installing collected packages: psutil
Running setup.py install for psutil ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-c9s3nce8/psutil/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-c9s3nce8/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/tmp/pip-record-syvhpqg0/install-record.txt --single-version-externally-managed --compile
cwd: /private/tmp/pip-install-c9s3nce8/psutil/
Complete output (106 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.6-intel-3.6
creating build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_pswindows.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_common.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/__init__.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_psosx.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_psbsd.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_psaix.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_pslinux.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_compat.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_psposix.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_pssunos.py -> build/lib.macosx-10.6-intel-3.6/psutil
creating build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/runner.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/__init__.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_process.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_system.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/__main__.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
running build_ext
building 'psutil._psutil_osx' extension
creating build/temp.macosx-10.6-intel-3.6
creating build/temp.macosx-10.6-intel-3.6/psutil
creating build/temp.macosx-10.6-intel-3.6/psutil/arch
creating build/temp.macosx-10.6-intel-3.6/psutil/arch/osx
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=565 -DPSUTIL_OSX=1 -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c psutil/_psutil_common.c -o build/temp.macosx-10.6-intel-3.6/psutil/_psutil_common.o
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=565 -DPSUTIL_OSX=1 -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c psutil/_psutil_posix.c -o build/temp.macosx-10.6-intel-3.6/psutil/_psutil_posix.o
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=565 -DPSUTIL_OSX=1 -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c psutil/_psutil_osx.c -o build/temp.macosx-10.6-intel-3.6/psutil/_psutil_osx.o
In file included from psutil/_psutil_osx.c:36:
In file included from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:
In file included from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:
/usr/local/include/Block.h:16:3: error: Never include this file directly. Use <lzma.h> instead.
# error Never include this file directly. Use <lzma.h> instead.
^
/usr/local/include/Block.h:93:2: error: unknown type name 'lzma_check'
lzma_check check;
^
/usr/local/include/Block.h:148:2: error: unknown type name 'lzma_vli'
lzma_vli compressed_size;
^
/usr/local/include/Block.h:172:2: error: unknown type name 'lzma_vli'
lzma_vli uncompressed_size;
^
/usr/local/include/Block.h:200:2: error: unknown type name 'lzma_filter'
lzma_filter *filters;
^
/usr/local/include/Block.h:217:20: error: use of undeclared identifier 'LZMA_CHECK_SIZE_MAX'
uint8_t raw_check[LZMA_CHECK_SIZE_MAX];
^
/usr/local/include/Block.h:231:2: error: unknown type name 'lzma_vli'
lzma_vli reserved_int3;
^
/usr/local/include/Block.h:232:2: error: unknown type name 'lzma_vli'
lzma_vli reserved_int4;
^
/usr/local/include/Block.h:233:2: error: unknown type name 'lzma_vli'
lzma_vli reserved_int5;
^
/usr/local/include/Block.h:234:2: error: unknown type name 'lzma_vli'
lzma_vli reserved_int6;
^
/usr/local/include/Block.h:235:2: error: unknown type name 'lzma_vli'
lzma_vli reserved_int7;
^
/usr/local/include/Block.h:236:2: error: unknown type name 'lzma_vli'
lzma_vli reserved_int8;
^
/usr/local/include/Block.h:237:2: error: unknown type name 'lzma_reserved_enum'
lzma_reserved_enum reserved_enum1;
^
/usr/local/include/Block.h:238:2: error: unknown type name 'lzma_reserved_enum'
lzma_reserved_enum reserved_enum2;
^
/usr/local/include/Block.h:239:2: error: unknown type name 'lzma_reserved_enum'
lzma_reserved_enum reserved_enum3;
^
/usr/local/include/Block.h:240:2: error: unknown type name 'lzma_reserved_enum'
lzma_reserved_enum reserved_enum4;
^
/usr/local/include/Block.h:261:2: error: unknown type name 'lzma_bool'
lzma_bool ignore_check;
^
/usr/local/include/Block.h:263:2: error: unknown type name 'lzma_bool'
lzma_bool reserved_bool2;
^
/usr/local/include/Block.h:264:2: error: unknown type name 'lzma_bool'
lzma_bool reserved_bool3;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
error: command '/usr/bin/clang' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-c9s3nce8/psutil/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-c9s3nce8/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/tmp/pip-record-syvhpqg0/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

解决方案如下:

brew doctor
rm /usr/local/include/block.h
pip3 install psutil

即可见到久违的安装成功提示

Successfully installed psutil-5.6.5

亲测有效哦!

Mac 无法安装安装psutil 报错 error: command '/usr/bin/clang' failed with exit status 1的更多相关文章

  1. xcode 运行报错 Command /usr/bin/codesign failed with exit code 1

           因为更换了证书,导致在运行时报错 Command /usr/bin/codesign failed with exit code 1,查看了网上各种方法,最后发现以下两个值没有同步更新

  2. 安装matplotlib,报错ERROR: Command errored out with exit status 1:

    使用pip install matplotlib 出现报错信息: 发现这行报错 : 我是在pycharm上安装的,可是提示我去安装 Microsoft Visual C++ ,然后去百度查了下,发现只 ...

  3. no identity found Command /usr/bin/codesign failed with exit code 1 报错解决方法

    stackoverflow 的解决方法是 xcode->preference->account->view detail -> refresh the provisioning ...

  4. xcode6 真机运行报错 Command /usr/bin/codesign failed with exit code 1

    解决方法: 百度下载‘iphone配置实用工具’, 打开此软件之后,选择预配置描述文件, 选中iphone过期和重复的描述文件,按delete键删除.然后重启xcode即可

  5. windows 8 安装 oracle 11g 报错:command line option syntax error,type command/? for help

    windows 8 安装 oracle 11g 报错:command line option syntax error,type command/? for help 在windows8操作系统上安装 ...

  6. php源码安装执行configure报错error: off_t undefined; check your library configuration

    php安装执行configure报错error: off_t undefined; check your library configuration vim /etc/ld.so.conf 添加如下几 ...

  7. iOS开发之--png图片编译时报错 (Command /Applications/Xcode.app/Contents/Developer/usr/bin/copypng failed with exit code 1 )

    编译或者运行APP的时候,老是报这个错误:Command /Applications/Xcode.app/Contents/Developer/usr/bin/copypng failed with ...

  8. python安装模块的时候报错error: command 'gcc' failed with exit status 1

    [情况] 在写Python代码的时候,需要用到psutil模块,需要安装. 但是在安装时,报错:error: command 'gcc' failed with exit status 1 [解决步骤 ...

  9. [原创] ubuntu下安装scrapy报错 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    Ubuntu14.04在virtualenv下安装scrapy报错,Failed building wheel for cffi,lxml,cryptography 等. error: command ...

随机推荐

  1. Java学习:switch语句使用的注意事项

    switch语句使用的注意事项: 多个case后面的数值不可以重复. switch后面的小括当中只能是下列数据类型: 基本数据类型:byte/short/char/int 引用数据类型:String字 ...

  2. -Git 使用技巧 总结 MD

    目录 目录 Bash下的快捷操作 常用命令 常用操作 移动光标 删除输入内容 Tab键的作用 Git默认Vim编辑器基本使用 Git 使用场景 合并多个commit:rebase -i[s] 删除多个 ...

  3. 分布式系统根基:物理时钟和Lamport逻辑时钟

    分布式系统解决了传统单体架构的单点问题和性能容量问题,另一方面也带来了很多的问题,其中一个问题就是多节点的时间同步问题:不同机器上的物理时钟难以同步,导致无法区分在分布式系统中多个节点的事件时序.19 ...

  4. IDEA超级实用的几个快捷键

    最近开始使用IDEA,突然发现的比较的实用的几个快捷键 这些快捷键用的好的话真的可以提升很多效率 还有一些比较简单的快捷键,相信大家都会 Ctrl+X:剪切 Ctrl+C:复制 Ctrl+V:粘贴 C ...

  5. os.mkdir()与 shutil.rmtree()对文件夹的 创建与删除

    import osimport shutil # os.mkdir('C:/Users/Desktop/123') # 表示在桌面上创建文件# os.mkdir('123') # 表示在此代码文件下创 ...

  6. 【MySQL】数据库事务深入分析

    一.前言 只有InnoDB引擎支持事务,下边的内容均以InnoDB引擎为默认条件 二.常见的并发问题 1.脏读 一个事务读取了另一个事务未提交的数据 2.不可重复读 一个事务对同一数据的读取结果前后不 ...

  7. MongoDB常用数据库命令第二集

    =======================基础命令======================= mongo 进入数据库操作界面db 查看当前使用的数据库show dbs 查看当前已经被创建出来的 ...

  8. Redux 进阶之 react-redux 和 redux-thunk 的应用

    1. react-redux React-Redux 是 Redux 的官方 React 绑定库. React-Redux 能够使你的React组件从Redux store中读取数据,并且向 stor ...

  9. MySQL MHA--主库故障检测

    MHA主库检查参数 MHA从0.53版本开始支持ping_type参数来设置如何检查master可用性:ping_type=select: 基于一个到master的已经存在的连接执行select 1, ...

  10. 环境搭建:Jupyter Notebook 密码设置

    原文参考:关于jupyter notebook密码设置 原文博主: 一.windows下,打开命令行,重新生成一个jupyter配置文件 jupyter notebook --generate-con ...