Installing pip in Python < 3.6
Installing pip using the script provided may encounter errors due to recent changes in pip's support.
Cause
pip 21.0 onwards requires Python 3.6 or higher. The syntax employed in the provided script is supported by these later versions of Python.
Solution
To install pip for Python 2.7 and 3.5, follow these steps:
Python 2.7:
Download pip from https://bootstrap.pypa.io/pip/2.7/:
curl -O https://bootstrap.pypa.io/pip/2.7/get-pip.py
Install pip:
python get-pip.py
Upgrade pip to the latest supported version (currently 20.3.4):
python -m pip install --upgrade "pip < 21.0"
Python 3.6:
Download pip from https://bootstrap.pypa.io/pip/3.6/:
curl -O https://bootstrap.pypa.io/pip/3.6/get-pip.py
Install pip:
python get-pip.py
Python 3.5:
Download pip from https://bootstrap.pypa.io/pip/3.5/:
curl -O https://bootstrap.pypa.io/pip/3.5/get-pip.py
Install pip:
python get-pip.py
Python 3.4:
Download pip from https://bootstrap.pypa.io/pip/3.4/:
curl -O https://bootstrap.pypa.io/pip/3.4/get-pip.py
Install pip:
python get-pip.py
Upgrade pip to the latest supported version (currently 19.2):
python -m pip install --upgrade "pip < 19.2"
The above is the detailed content of How Can I Install pip in Python Versions Older Than 3.6?. For more information, please follow other related articles on the PHP Chinese website!