安裝psutil模塊報錯&安裝python-devel


psutil/_psutil_linux.c:9:20: 錯誤:Python.h:沒有那個文件或目錄

In file included from psutil/_psutil_linux.c:19:
psutil/_psutil_linux.h:11: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:12: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:13: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:14: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:15: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:16: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:17: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c: 在函數‘ioprio_get’中:
psutil/_psutil_linux.c:32: 警告:隱式聲明函數‘syscall’
psutil/_psutil_linux.c: 在文件層:
psutil/_psutil_linux.c:52: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:75: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:100: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:150: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:172: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:192: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:213: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:261: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PsutilMethods’
psutil/_psutil_linux.c:285: 錯誤:expected specifier-qualifier-list before ‘PyObject’
psutil/_psutil_linux.c: 在函數‘init_psutil_linux’中:
psutil/_psutil_linux.c:335: 錯誤:‘PyObject’未聲明(在此函數內第一次使用)
psutil/_psutil_linux.c:335: 錯誤:(即使在一個函數內多次出現,每個未聲明的標識符在其
psutil/_psutil_linux.c:335: 錯誤:所在的函數內也只報告一次。)
psutil/_psutil_linux.c:335: 錯誤:‘module’未聲明(在此函數內第一次使用)
psutil/_psutil_linux.c:335: 警告:隱式聲明函數‘Py_InitModule’
psutil/_psutil_linux.c:335: 錯誤:‘PsutilMethods’未聲明(在此函數內第一次使用)
error: command 'gcc' failed with exit status 1

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

解決方法是安裝python-devel,這是Python的頭文件和靜態庫包:

1.可以先查看一下含python-devel的包

    yum search python | grep python-devel

2.64位安裝python-devel.x86_64,32位安裝python-devel.i686,我這里安裝:

    sudo yum install python-devel.x86_64


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM