- 資訊首頁(yè) > 網(wǎng)絡(luò )安全 >
- 安裝psutil模塊報錯怎么解決
這篇文章主要講解了“安裝psutil模塊報錯怎么解決”,文中的講解內容簡(jiǎn)單清晰,易于學(xué)習與理解,下面請大家跟著(zhù)小編的思路慢慢深入,一起來(lái)研究和學(xué)習“安裝psutil模塊報錯怎么解決”吧!
'*' token
psutil/_psutil_linux.c:190: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
psutil/_psutil_linux.c:240: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
psutil/_psutil_linux.c:268: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
psutil/_psutil_linux.c:375: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
psutil/_psutil_linux.c:433: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
psutil/_psutil_linux.c:482: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
psutil/_psutil_linux.c:543: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'PsutilMethods'
psutil/_psutil_linux.c:582: error: expected specifier-qualifier-list before 'PyObject'
psutil/_psutil_linux.c: In function 'init_psutil_linux':
psutil/_psutil_linux.c:628: error: 'PyObject' undeclared (first use in this function)
psutil/_psutil_linux.c:628: error: (Each undeclared identifier is reported only once
psutil/_psutil_linux.c:628: error: for each function it appears in.)
psutil/_psutil_linux.c:628: error: 'v' undeclared (first use in this function)
psutil/_psutil_linux.c:632: error: 'module' undeclared (first use in this function)
psutil/_psutil_linux.c:632: warning: implicit declaration of function 'Py_InitModule'
psutil/_psutil_linux.c:632: error: 'PsutilMethods' undeclared (first use in this function)
psutil/_psutil_linux.c:635: warning: implicit declaration of function 'PyModule_AddIntConstant'
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-cY1TLx/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-J4cL69-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-cY1TLx/psutil/
===============================================================
解決方法是安裝python-devel,這是Python的頭文件和靜態(tài)庫包:
[root@localhost ~]# yum install python-devel.x86_64
Failed to set locale, defaulting to C
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package python-devel.x86_64 0:2.6.6-51.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================
Package Arch Version Repository Size
===============================================================================================
Installing:
python-devel x86_64 2.6.6-51.el6 cdrom-server 171 k
Transaction Summary
===============================================================================================
Install 1 Package(s)
Total download size: 171 k
Installed size: 456 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : python-devel-2.6.6-51.el6.x86_64 1/1
Verifying : python-devel-2.6.6-51.el6.x86_64 1/1
Installed:
python-devel.x86_64 0:2.6.6-51.el6
Complete!
在用pip安裝psutil模塊
[root@localhost ~]# pip install psutil
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Collecting psutil
Using cached psutil-5.0.1.tar.gz
Installing collected packages: psutil
Running setup.py install for psutil ... done
Successfully installed psutil-5.0.1
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng )、來(lái)自互聯(lián)網(wǎng)轉載和分享為主,文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權請聯(lián)系QQ:712375056 進(jìn)行舉報,并提供相關(guān)證據,一經(jīng)查實(shí),將立刻刪除涉嫌侵權內容。
Copyright ? 2009-2021 56dr.com. All Rights Reserved. 特網(wǎng)科技 特網(wǎng)云 版權所有 珠海市特網(wǎng)科技有限公司 粵ICP備16109289號
域名注冊服務(wù)機構:阿里云計算有限公司(萬(wàn)網(wǎng)) 域名服務(wù)機構:煙臺帝思普網(wǎng)絡(luò )科技有限公司(DNSPod) CDN服務(wù):阿里云計算有限公司 中國互聯(lián)網(wǎng)舉報中心 增值電信業(yè)務(wù)經(jīng)營(yíng)許可證B2
建議您使用Chrome、Firefox、Edge、IE10及以上版本和360等主流瀏覽器瀏覽本網(wǎng)站