安裝docker-compose各種報錯,現(xiàn)記錄錯誤涯穷,以便備用噪径。
1柱恤、有一臺本地服務(wù)器centos7.9已經(jīng)安裝了docker,docker版本:20.10.22
image.png
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/
image.png
3、我們應(yīng)該先處理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
安裝成功
image.png
查看版本
> sudo docker-compose --version
image.png