您好,登錄后才能下訂單哦!
這期內(nèi)容當(dāng)中小編將會(huì)給大家?guī)?lái)有關(guān)openstack nova編譯或打包rpm出現(xiàn)cannot import name integer_types報(bào)錯(cuò)的解決方法,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
通過(guò)rpmbuild打包nova時(shí),出現(xiàn)了如下報(bào)錯(cuò):
File "/usr/lib/python2.7/site-packages/keystoneauth2/session.py", line 26, in <module> import requests File "/usr/lib/python2.7/site-packages/requests/__init__.py", line 63, in <module> from . import utils File "/usr/lib/python2.7/site-packages/requests/utils.py", line 26, in <module> from .compat import ( ImportError: cannot import name integer_types
大致看了以下報(bào)錯(cuò)信息,應(yīng)該是python的requests模塊安裝有問(wèn)題,查看之前的依賴安裝日志,出現(xiàn)過(guò)如下內(nèi)容:
Failed: python2-requests.noarch 0:2.11.1-1.el7 python2-urllib3.noarch 0:1.16-1.el7
這兩個(gè)模塊安裝失敗,于是單獨(dú)安裝這兩個(gè)模塊,但是均報(bào)錯(cuò)
Downloading packages: (1/2): python2-urllib3-1.16-1.el7.noarch.rpm | 126 kB 00:00:00 (2/2): python2-requests-2.11.1-1.el7.noarch.rpm | 105 kB 00:00:00 ------------------------------------------------------------------------------------------------------------------------------------------------------- Total 190 kB/s | 231 kB 00:00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : python2-urllib3-1.16-1.el7.noarch 1/2 Error unpacking rpm package python2-urllib3-1.16-1.el7.noarch error: unpacking of archive failed on file /usr/lib/python2.7/site-packages/urllib3/packages/ssl_match_hostname: cpio: rename Installing : python2-requests-2.11.1-1.el7.noarch 2/2 Error unpacking rpm package python2-requests-2.11.1-1.el7.noarch error: python2-urllib3-1.16-1.el7.noarch: install failed error: unpacking of archive failed on file /usr/lib/python2.7/site-packages/requests/packages/chardet: cpio: rename Verifying : python2-urllib3-1.16-1.el7.noarch 1/2 Verifying : python2-requests-2.11.1-1.el7.noarch 2/2 Failed: python2-requests.noarch 0:2.11.1-1.el7 python2-urllib3.noarch 0:1.16-1.el7
應(yīng)該是這兩個(gè)模塊已存在的版本有問(wèn)題,于是將site-packages中的這兩個(gè)模塊的內(nèi)容刪除
[root@localhost site-packages]# rm -rf url urlgrabber/ urllib3/ urllib3-1.21.dist-info/ urlgrabber-3.10-py2.7.egg-info urllib3-1.16-py2.7.egg-info/ [root@localhost site-packages]# rm -rf urllib3* [root@localhost site-packages]# rm -rf requests requests/ requestsexceptions/ requests_mock/ requests-2.11.1-py2.7.egg-info/ requestsexceptions-1.1.3-py2.7.egg-info/ requests_mock-1.3.0.dist-info/ requests-2.13.0.dist-info/ requestsexceptions-1.2.0.dist-info/ [root@localhost site-packages]# rm -rf requests [root@localhost site-packages]# rm -rf requests-*
再安裝模塊即可成功
Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : python2-urllib3-1.16-1.el7.noarch 1/2 Installing : python2-requests-2.11.1-1.el7.noarch 2/2 Verifying : python2-urllib3-1.16-1.el7.noarch 1/2 Verifying : python2-requests-2.11.1-1.el7.noarch 2/2 Installed: python2-requests.noarch 0:2.11.1-1.el7 Dependency Installed: python2-urllib3.noarch 0:1.16-1.el7 Complete!
再通過(guò)rpmbuild打包,就沒(méi)有任何問(wèn)題了。
上述就是小編為大家分享的openstack nova編譯或打包rpm出現(xiàn)cannot import name integer_types報(bào)錯(cuò)的解決方法了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。