安装docker-compose各种报错,现记录错误,以便备用。
1、有一台本地服务器centos7.9已经安装了docker,docker版本:20.10.22
2、使用pip进行安装,报错:
Collecting docker-compose
Using cached https://files.pythonhosted.org/packages/f3/3e/ca05e486d44e38eb495ca60b8ca526b192071717387346ed1031ecf78966/docker_compose-1.29.2-py2.py3-none-any.whl
Collecting cached-property<2,>=1.2.0; python_version < "3.8" (from docker-compose)
Using cached https://files.pythonhosted.org/packages/48/19/f2090f7dad41e225c7f2326e4cfe6fff49e57dedb5b53636c9551f86b069/cached_property-1.5.2-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): backports.ssl-match-hostname<4,>=3.5; python_version < "3.5" in /usr/lib/python2.7/site-packages (from docker-compose)
Collecting distro<2,>=1.5.0 (from docker-compose)
Using cached https://files.pythonhosted.org/packages/4b/89/eaa3a3587ebf8bed93e45aa79be8c2af77d50790d15b53f6dfc85b57f398/distro-1.8.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/tmp/pip-build-PVhtts/distro/setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-PVhtts/distro/
3、我们应该先处理pip的问题,先更新pip:
# 安装 EPEL 软件包
sudo yum install epel-release
# 安装pip
sudo yum install -y python-pip
# 升级pip
sudo pip install --upgrade pip
4、此时依旧有报错,使用如下办法处理:
①2.7版本
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python get-pip.py
5、下面是常见错误及解决方法
安装pip
安装 EPEL 软件包
sudo yum install epel-release
安装pip
sudo yum install -y python-pip
升级pip
sudo pip install --upgrade pip
安装docker-compose时报错
sudo pip install docker-compose
- 第一次报错(sudo pip install docker-compose时)
ERROR: jsonschema 3.2.0 has requirement six>=1.11.0, but you'll have six 1.9.0 which is incompatible.- 解决方法
sudo pip install six --user -U
- 第二次报错(sudo 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.- 解决方法
搜索subprocess32-3.2.6-py2.7.egg-info文件
sudo find / -name subpro.egg-info
删除
rm -rf /usr/lib64/python2.7/site-packages/subprocess32-3.2.6-py2.7.egg-info
- 第三次报错(sudo pip install subprocess32 -U时)
configure: error: no acceptable C compiler found in $PATH- 解决方法
sudo yum install -y gcc
- 第四次报错(sudo pip install subprocess32 -U时)
error: command 'gcc' failed with exit status 1- 解决方法
安装openssl-devel
sudo yum install gcc libffi-devel python-devel openssl-devel -y
- 第五次报错(sudo pip install docker-compose时)
RROR: 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.- 解决方法
搜索requests-2.6.0-py2.7.egg-info文件
sudo find / -name requests.egg-info
删除
rm -rf /usr/lib/python2.7/site-packages/requests-2.6.0-py2.7.egg-info
最后再次安装docker-compose
sudo pip install docker-compose
安装成功
查看版本
> sudo docker-compose --version