Python 安装psutil包遇到的问题

举报
tscswcn 发表于 2019/02/09 00:24:55 2019/02/09
【摘要】 [root@node-1 gcc-4.8.2]# sudo pip install --user psutilDEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained af...

[root@node-1 gcc-4.8.2]# sudo pip  install --user  psutil

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.

Collecting psutil

  Using cached https://files.pythonhosted.org/packages/6e/a0/833bcbcede5141cc5615e50c7cc5b960ce93d9c9b885fbe3b7d36e48a2d4/psutil-5.5.0.tar.gz

Building wheels for collected packages: psutil

  Building wheel for psutil (setup.py) ... error

  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-uAr_gl/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 /tmp/pip-wheel-vbL04e --python-tag cp27:

  /usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution

option: 'python_requires'

    warnings.warn(msg)

  running bdist_wheel

  running build

  running build_py

  creating build

  creating build/lib.linux-x86_64-2.7

  creating build/lib.linux-x86_64-2.7/psutil

  copying psutil/_compat.py -> build/lib.linux-x86_64-2.7/psutil

  copying psutil/_psposix.py -> build/lib.linux-x86_64-2.7/psutil

  copying psutil/_exceptions.py -> build/lib.linux-x86_64-2.7/psutil

  copying psutil/_psaix.py -> build/lib.linux-x86_64-2.7/psutil

  copying psutil/_pssunos.py -> build/lib.linux-x86_64-2.7/psutil

  copying psutil/_pslinux.py -> build/lib.linux-x86_64-2.7/psutil

  copying psutil/_common.py -> build/lib.linux-x86_64-2.7/psutil

  copying psutil/__init__.py -> build/lib.linux-x86_64-2.7/psutil

  copying psutil/_psosx.py -> build/lib.linux-x86_64-2.7/psutil

  copying psutil/_psbsd.py -> build/lib.linux-x86_64-2.7/psutil

  copying psutil/_pswindows.py -> build/lib.linux-x86_64-2.7/psutil

  creating build/lib.linux-x86_64-2.7/psutil/tests

  copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-2.7/psutil/tests

  copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-2.7/psutil/tests

  copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-2.7/psutil/tests

  copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-2.7/psutil/tests

  copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-2.7/psutil/tests

  copying psutil/tests/__main__.py -> build/lib.linux-x86_64-2.7/psutil/tests

  copying psutil/tests/test_process.py -> build/lib.linux-x86_64-2.7/psutil/tests

  copying psutil/tests/test_system.py -> build/lib.linux-x86_64-2.7/psutil/tests

  copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-2.7/psutil/tests

  copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-2.7/psutil/tests

  copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-2.7/psutil/tests

  copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-2.7/psutil/tests

  copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-2.7/psutil/tests

  copying psutil/tests/__init__.py -> build/lib.linux-x86_64-2.7/psutil/tests

  copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-2.7/psutil/tests

  copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-2.7/psutil/tests

  running build_ext

  building 'psutil._psutil_linux' extension

  creating build/temp.linux-x86_64-2.7

  creating build/temp.linux-x86_64-2.7/psutil

  gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=550 -DPSUTIL_LINUX=1 -I/usr/include/python2.7 -c psutil/_psutil_common.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_common.o

  psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory

   #include <Python.h>

                      ^

  compilation terminated.

  error: command 'gcc' failed with exit status 1


  ----------------------------------------

  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

    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-uAr_gl/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 /tmp/pip-record-Tj6uEX/install-record.txt --single-version-externally-managed --compile --user --prefix=:

    /usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'

      warnings.warn(msg)

    running install

    running build

    running build_py

    creating build

    creating build/lib.linux-x86_64-2.7

    creating build/lib.linux-x86_64-2.7/psutil

    copying psutil/_compat.py -> build/lib.linux-x86_64-2.7/psutil

    copying psutil/_psposix.py -> build/lib.linux-x86_64-2.7/psutil

    copying psutil/_exceptions.py -> build/lib.linux-x86_64-2.7/psutil

    copying psutil/_psaix.py -> build/lib.linux-x86_64-2.7/psutil

    copying psutil/_pssunos.py -> build/lib.linux-x86_64-2.7/psutil

    copying psutil/_pslinux.py -> build/lib.linux-x86_64-2.7/psutil

    copying psutil/_common.py -> build/lib.linux-x86_64-2.7/psutil

    copying psutil/__init__.py -> build/lib.linux-x86_64-2.7/psutil

    copying psutil/_psosx.py -> build/lib.linux-x86_64-2.7/psutil

    copying psutil/_psbsd.py -> build/lib.linux-x86_64-2.7/psutil

    copying psutil/_pswindows.py -> build/lib.linux-x86_64-2.7/psutil

    creating build/lib.linux-x86_64-2.7/psutil/tests

    copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-2.7/psutil/tests

    copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-2.7/psutil/tests

    copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-2.7/psutil/tests

    copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-2.7/psutil/tests

    copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-2.7/psutil/tests

    copying psutil/tests/__main__.py -> build/lib.linux-x86_64-2.7/psutil/tests

    copying psutil/tests/test_process.py -> build/lib.linux-x86_64-2.7/psutil/tests

    copying psutil/tests/test_system.py -> build/lib.linux-x86_64-2.7/psutil/tests

    copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-2.7/psutil/tests

    copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-2.7/psutil/tests

    copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-2.7/psutil/tests

    copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-2.7/psutil/tests

    copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-2.7/psutil/tests

    copying psutil/tests/__init__.py -> build/lib.linux-x86_64-2.7/psutil/tests

    copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-2.7/psutil/tests

    copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-2.7/psutil/tests

    running build_ext

    building 'psutil._psutil_linux' extension

    creating build/temp.linux-x86_64-2.7

    creating build/temp.linux-x86_64-2.7/psutil

    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=550 -DPSUTIL_LINUX=1 -I/usr/include/python2.7 -c psutil/_psutil_common.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_common.o

    psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory

     #include <Python.h>

                        ^

    compilation terminated.

    error: command 'gcc' failed with exit status 1


    ----------------------------------------

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-uAr_gl/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 /tmp/pip-record-Tj6uEX/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-uAr_gl/psutil/ 




后通过 如下 解决


 yum install python-devel -y

Loaded plugins: langpacks, versionlock

Resolving Dependencies

--> Running transaction check

---> Package python-devel.x86_64 0:2.7.5-76.el7 will be installed

--> Processing Dependency: python(x86-64) = 2.7.5-76.el7 for package: python-devel-2.7.5-76.el7.x86_64

--> Running transaction check

---> Package python.x86_64 0:2.7.5-48.el7 will be updated

---> Package python.x86_64 0:2.7.5-76.el7 will be an update

--> Processing Dependency: python-libs(x86-64) = 2.7.5-76.el7 for package: python-2.7.5-76.el7.x86_64

--> Running transaction check

---> Package python-libs.x86_64 0:2.7.5-48.el7 will be updated

---> Package python-libs.x86_64 0:2.7.5-76.el7 will be an update

--> Finished Dependency Resolution


Dependencies Resolved


================================================================================

 Package              Arch           Version                 Repository    Size

================================================================================

Installing:

 python-devel         x86_64         2.7.5-76.el7            base         398 k

Updating for dependencies:

 python               x86_64         2.7.5-76.el7            base          94 k

 python-libs          x86_64         2.7.5-76.el7            base         5.6 M


Transaction Summary

================================================================================

Install  1 Package

Upgrade             ( 2 Dependent packages)


Total download size: 6.1 M

Downloading packages:

Delta RPMs disabled because /usr/bin/applydeltarpm not installed.

(1/3): python-devel-2.7.5-76.el7.x86_64.rpm                | 398 kB   00:00

(2/3): python-2.7.5-76.el7.x86_64.rpm                      |  94 kB   00:00

(3/3): python-libs-2.7.5-76.el7.x86_64.rpm                 | 5.6 MB   00:00

--------------------------------------------------------------------------------

Total                                               38 MB/s | 6.1 MB  00:00

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  Updating   : python-libs-2.7.5-76.el7.x86_64                              1/5

  Updating   : python-2.7.5-76.el7.x86_64                                   2/5

  Installing : python-devel-2.7.5-76.el7.x86_64                             3/5

  Cleanup    : python-2.7.5-48.el7.x86_64                                   4/5

  Cleanup    : python-libs-2.7.5-48.el7.x86_64                              5/5

  Verifying  : python-2.7.5-76.el7.x86_64                                   1/5

  Verifying  : python-devel-2.7.5-76.el7.x86_64                             2/5

  Verifying  : python-libs-2.7.5-76.el7.x86_64                              3/5

  Verifying  : python-2.7.5-48.el7.x86_64                                   4/5

  Verifying  : python-libs-2.7.5-48.el7.x86_64                              5/5


Installed:

  python-devel.x86_64 0:2.7.5-76.el7


Dependency Updated:

  python.x86_64 0:2.7.5-76.el7         python-libs.x86_64 0:2.7.5-76.el7


Complete!

[root@node-1 gcc-4.8.2]# sudo pip  install --user  psutil

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.

Collecting psutil

  Using cached https://files.pythonhosted.org/packages/6e/a0/833bcbcede5141cc5615e50c7cc5b960ce93d9c9b885fbe3b7d36e48a2d4/psutil-5.5.0.tar.gz

Building wheels for collected packages: psutil

  Building wheel for psutil (setup.py) ... done

  Stored in directory: /root/.cache/pip/wheels/23/6f/5a/f84c1790d7c9be43de2842cf8782fa84c9ec07e72b041d7251

Successfully built psutil

Installing collected packages: psutil

Successfully installed psutil-5.5.0 


【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。