如何利用yum源和pip安装 docker-compose

今天打算用docker部署一个东西,发现没安装docker-compose,于是安装了一翻。所以我的docker是之前就安装好的,记住啊,要先安装docker才可以安装 docker-compose。

首先添加EPEL源

yum install -y epel-release

然后安装python pip

yum install -y python-pip

安装docker-compose

pip install docker-compose

结果报错:Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-RdTF8W/distro/
You are using pip version 8.1.2, however version 23.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

 于是执行命令,这个是百度得到的可靠的答案

# 升级pip:
1.sudo wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
2.sudo python get-pip.py
3.pip -V

# 升级pip3:
1.sudo wget https://bootstrap.pypa.io/pip/3.5/get-pip.py
2.sudo python3 get-pip.py
3.pip -V
然后执行安装命令pip install docker-compose

结果又抛出错

ERROR: Cannot uninstall 'subprocess32'. 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.

于是解决方案为

[root@localhost ~]# sudo find / -name *subpro*.egg-info
/usr/lib64/python2.7/site-packages/subprocess32-3.2.6-py2.7.egg-info
[root@localhost ~]# rm -rf /usr/lib64/python2.7/site-packages/subprocess32-3.2.6-py2.7.egg-info

然后再执行安装命令

又抛错ERROR: 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.

解决方案为

[root@localhost ~]# sudo find / -name *requests*.egg-info
/usr/lib/python2.7/site-packages/requests-2.6.0-py2.7.egg-info
[root@localhost ~]# rm -rf /usr/lib/python2.7/site-packages/requests-2.6.0-py2.7.egg-info

再执行安装命令

又抛错

ERROR: pip's legacy dependency resolver does not consider dependency conflicts when selecting packages. This behaviour is the source of the following dependency conflicts.
jsonschema 3.2.0 requires six>=1.11.0, but you'll have six 1.9.0 which is incompatible.
ipapython 4.6.8 requires dnspython>=1.15, but you'll have dnspython 1.12.0 which is incompatible.
ipapython 4.6.8 requires python-ldap>=3.0.0b1, but you'll have python-ldap 2.4.15 which is incompatible.
解决方案为

 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple six>=1.11.0
 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple dnspython>=1.15
 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple python-ldap>=3.0.0b1

然后再次执行安装命令,安装成功

执行验证

[root@localhost ~]# docker-compose -version
 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值