博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
openstack nova编译或打包rpm出现cannot import name integer_types报错的解决
阅读量:6306 次
发布时间:2019-06-22

本文共 4336 字,大约阅读时间需要 14 分钟。

hot3.png

通过rpmbuild打包nova时,出现了如下报错:

File "/usr/lib/python2.7/site-packages/keystoneauth1/session.py", line 26, in 
import requests File "/usr/lib/python2.7/site-packages/requests/__init__.py", line 63, in
from . import utils File "/usr/lib/python2.7/site-packages/requests/utils.py", line 26, in
from .compat import (ImportError: cannot import name integer_types

大致看了以下报错信息,应该是python的requests模块安装有问题,查看之前的依赖安装日志,出现过如下内容:

Failed:  python2-requests.noarch 0:2.11.1-1.el7                                      python2-urllib3.noarch 0:1.16-1.el7

这两个模块安装失败,于是单独安装这两个模块,但是均报错

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 checkRunning transaction testTransaction test succeededRunning transaction  Installing : python2-urllib3-1.16-1.el7.noarch                                                                                                   1/2 Error unpacking rpm package python2-urllib3-1.16-1.el7.noarcherror: 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.noarcherror: python2-urllib3-1.16-1.el7.noarch: install failederror: 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

应该是这两个模块已存在的版本有问题,于是将site-packages中的这两个模块的内容删除

[root@localhost site-packages]# rm -rf urlurlgrabber/                     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 requestsrequests/                                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 checkRunning transaction testTransaction test succeededRunning 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!

再通过rpmbuild打包,就没有任何问题了。

转载于:https://my.oschina.net/sannychan/blog/888021

你可能感兴趣的文章
day11 reduce函数
查看>>
Scrapy 框架 - 简介
查看>>
在SuperSocket中启用TLS/SSL传输层加密
查看>>
py 的 第 37 天
查看>>
文本的四种编码方式
查看>>
img 是内联元素
查看>>
ecshop调用指定栏目下的文章的方法
查看>>
C 入门 第六节 自定义函数
查看>>
leetcode--Balanced Binary Tree
查看>>
locate
查看>>
取消输入框的轮廓线,禁止拖拽
查看>>
关于new enhancement的一些知识
查看>>
Yii2 增删查改
查看>>
预言帖,WP7迟早有一天会失败
查看>>
加载静态文件,父模板的继承和扩展
查看>>
发布功能完成
查看>>
应用部署策略
查看>>
JS 字符串
查看>>
习题6-3 UVa536 Tree Recovery(树的遍历转换)
查看>>
在虚拟机里安装VMwareTools工具(详解)
查看>>