前提:CentOS 7 下安装Python环境,从而运行docker-compose

一般情况下,用yum的安装顺序如下:

1. yum -y install epel-release

2. yum -y install python-pip

3. pip install docker-compose

在执行第二步的时候报错,报错内容如下:

Requires: python(abi) = 2.6 

因为CentOS7,有的默认安装版本是2.7。

这时候,可以采用wget来安装Python环境

1. wget https://bootstrap.pypa.io/get-pip.py

2. sudo python get-pip.py

3. pip -V 确认安装成功

这时候再执行pip install docker-compose,如果成功,万事大吉,如果不成功,可能会报如下错误:

Cannot uninstall 'requests'. 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.

这时候,执行如下语句,即可成功:

sudo pip install --ignore-installed docker-compose

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐