安装python openstack lib时发生的一些错误

锺星洲
2023-12-01


今天,安装python的openstack组件的时候报了一些错误,解决后总结以下。

安装python-neutronclient

安装python-neutronclient的时候:

pip install python-neutronclient

如果报找不到c compiler的错误的话,需要先安装gcc的linux组件。以CentOS为例:

sudo yum install gcc

之后安装重新安装neutronclient,可能发生如下错误:

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 -I/usr/include/python2.7 -c _posixsubprocess.c -o build/temp.linux-x86_64-2.7/_posixsubprocess.o
_posixsubprocess.c:16:20: fatal error: Python.h: No such file or directory
#include “Python.h”
^
compilation terminated.
error: command ‘gcc’ failed with exit status 1

这个错误是因为缺少Linux的Python develop的组件,可以参考以下链接安装:
https://blog.csdn.net/u013414502/article/details/79531509

再次安装,成功。

安装python-glanceclient

安装Glance Client的时候:

pip install python-glanceclient

报错如下:

Installing collected packages: pyOpenSSL, python-glanceclient
Found existing installation: pyOpenSSL 0.13.1
ERROR: Cannot uninstall ‘pyOpenSSL’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

解决办法,安装指令加入如下参数:

pip install python-glanceclient --ignore-installed

成功安装Glance Client及新版的pyOpenSSL:

Collecting pyOpenSSL>=17.1.0 (from python-glanceclient)
Using cached https://files.pythonhosted.org/packages/01/c8/ceb170d81bd3941cbeb9940fc6cc2ef2ca4288d0ca8929ea4db5905d904d/pyOpenSSL-19.0.0-py2.py3-none-any.whl

 类似资料: