- 安装python-pip:
yum -y install epel-release
yum -y install python-pip - 安装Docker Compose:
pip install docker-compose - 查询版本
docker-compose version
- pip install docker-compose报错:
[root@localhost app]# pip install docker-compose
Traceback (most recent call last):
File “/usr/bin/pip”, line 9, in
load_entry_point(‘pip==21.0.1’, ‘console_scripts’, ‘pip’)()
File “/usr/lib/python2.7/site-packages/pkg_resources.py”, line 378, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/usr/lib/python2.7/site-packages/pkg_resources.py”, line 2566, in load_entry_point
return ep.load()
File “/usr/lib/python2.7/site-packages/pkg_resources.py”, line 2260, in load
entry = import(self.module_name, globals(),globals(), [‘name’])
File “/usr/lib/python2.7/site-packages/pip/_internal/cli/main.py”, line 60
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
pip install docker-compose报错解决方式:
- wget https://bootstrap.pypa.io/2.7/get-pip.py
- python get-pip.py
[root@localhost app]# wget https://bootstrap.pypa.io/2.7/get-pip.py
--2021-03-01 01:39:03-- https://bootstrap.pypa.io/2.7/get-pip.py
正在解析主机 bootstrap.pypa.io (bootstrap.pypa.io)... 151.101.108.175, 2a04:4e42:36::175
正在连接 bootstrap.pypa.io (bootstrap.pypa.io)|151.101.108.175|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1908226 (1.8M) [text/x-python]
正在保存至: “get-pip.py”
100%[===============================================================================================================>] 1,908,226 61.9KB/s 用时 40s
2021-03-01 01:39:43 (46.8 KB/s) - 已保存 “get-pip.py” [1908226/1908226])
[root@localhost app]# python get-pip.py
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting pip<21.0
Downloading pip-20.3.4-py2.py3-none-any.whl (1.5 MB)
|████████████████████████████████| 1.5 MB 15 kB/s
Collecting wheel
Downloading wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Installing collected packages: pip, wheel
Attempting uninstall: pip
Found existing installation: pip 21.0.1
Uninstalling pip-21.0.1:
Successfully uninstalled pip-21.0.1
Successfully installed pip-20.3.4 wheel-0.36.2
以下方式不能使用在pip已经升级为21之后:
pip install --upgrade “pip < 21.0”
// pip install --upgrade pip