在配置以下命令已安装的pypy解释器时出现错误
sudo yum install python-devel
sudo yum install gcc
运行时:
git clone https://github.com/giampaolo/psutil.git
cd psutil
python setup.py install
我们收到以下错误:
running install <br>
running bdist_egg <br>
running egg_info <br>
writing requirements to psutil.egg-info/requires.txt <br>
writing psutil.egg-info/PKG-INFO <br>
writing top-level names to psutil.egg-info/top_level.txt <br>
writing dependency_links to psutil.egg-info/dependency_links.txt <br>
reading manifest file 'psutil.egg-info/SOURCES.txt' <br>
reading manifest template 'MANIFEST.in' <br>
writing manifest file 'psutil.egg-info/SOURCES.txt' <br>
installing library code to build/bdist.linux-x86_64/egg <br>
running install_lib <br>
running build_py <br>
running build_ext <br>
building 'psutil._psutil_linux' extension <br>
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=548 -DPSUTIL_LINUX=1 -I/usr/local/include/python2.7 -c psutil/_psutil_common.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_common.o <br>
psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory <br>
#include <Python.h> <br>
^ <br>
compilation terminated. <br>
error: command 'gcc' failed with exit status 1 <br>
You have mail in /var/spool/mail/root <br> <br> <br>
此错误
pip install psutil
Collecting psutil <br>
Using cached <br>https://files.pythonhosted.org/packages/7d/9a/1e93d41708f8ed2b564395edfa3389f0fd6d567597401c2e5e2775118d8b/psutil-5.4.7.tar.gz <br>
Building wheels for collected packages: psutil <br>
Running setup.py bdist_wheel for psutil ... error <br>
Complete output from command /usr/local/bin/python2.7 -u -c "import <br>setuptools, tokenize;__file__='/tmp/pip-build-O38Z8x/psutil/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpU_ZGtJpip-wheel- --python-tag cp27: <br>
running bdist_wheel <br>
running build <br>
running build_py <br>
creating build <br>
creating build/lib.linux-x86_64-2.7 <br>
creating build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_exceptions.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_psposix.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_psbsd.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_psaix.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_pssunos.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_pslinux.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_common.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/__init__.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_psosx.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_compat.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_pswindows.py -> build/lib.linux-x86_64-2.7/psutil <br>
creating build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/__main__.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_system.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/__init__.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_process.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
running build_ext <br>
building 'psutil._psutil_linux' extension <br>
creating build/temp.linux-x86_64-2.7 <br>
creating build/temp.linux-x86_64-2.7/psutil <br>
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=547 -DPSUTIL_LINUX=1 -I/usr/local/include/python2.7 -c psutil/_psutil_common.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_common.o <br>
psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory
#include <Python.h> <br>
^ <br>
compilation terminated. <br>
error: command 'gcc' failed with exit status 1 <br>
---------------------------------------- <br>
Failed building wheel for psutil <br>
Running setup.py clean for psutil <br>
Failed to build psutil <br>
Installing collected packages: psutil <br>
Running setup.py install for psutil ... error <br>
Complete output from command /usr/local/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-O38Z8x/psutil/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-iGEGm2-record/install-record.txt --single-version-externally-managed --compile: <br>
running install <br>
running build <br>
running build_py <br>
creating build <br>
creating build/lib.linux-x86_64-2.7 <br>
creating build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_exceptions.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_psposix.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_psbsd.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_psaix.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_pssunos.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_pslinux.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_common.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/__init__.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_psosx.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_compat.py -> build/lib.linux-x86_64-2.7/psutil <br>
copying psutil/_pswindows.py -> build/lib.linux-x86_64-2.7/psutil <br>
creating build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/__main__.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_system.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/__init__.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_process.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-2.7/psutil/tests <br>
running build_ext <br>
building 'psutil._psutil_linux' extension <br>
creating build/temp.linux-x86_64-2.7 <br>
creating build/temp.linux-x86_64-2.7/psutil <br>
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=547 -DPSUTIL_LINUX=1 -I/usr/local/include/python2.7 -c psutil/_psutil_common.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_common.o <br>
psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory <br>
#include <Python.h> <br>
^ <br>
compilation terminated. <br>
error: command 'gcc' failed with exit status 1 <br>
甚至完成了以下链接中给出的所有解决方案
https://github.com/giampaolo/psutil/issues/1143
问题出在各自的pypy解释器上,并且在python上安装正常
答案 0 :(得分:0)
对于PyPy,您需要pypy-devel软件包