On a windows 7 machine I have pip version 1.5.6 installed:
pip 1.5.6 from C:\Users\dietz\PNC\tas\ENV\lib\site-packages (python 2.7) In order to find the reason for an error I want to install a different version of pip, which worked fine for me. So how can I uninstall pip and install version 1.2.1 instead?
5 Answers
pip itself is just a normal python package. Thus you can install pip with pip.
Of cource, you don't want to affect the system's pip, install it inside a virtualenv.
pip install pip==1.2.1 3If downgrading from pip version 10 because of PyCharm manage.py or other python errors:
python -m pip install pip==9.0.1 1If you want to upgrade or downgrade to different version of pip, better use --upgrade option at one go instead doing it in two steps. i.e. first uninstalling the existing and then re-installing to new version, below does both in one go as shown below.
USE: Executed on WIN10 with Bash
python -m pip install --upgrade pip==19.2.3
$ python -m pip install --upgrade pip==19.2.3 Collecting pip==19.2.3 Using cached pip-19.2.3-py2.py3-none-any.whl (1.4 MB) Installing collected packages: pip Attempting uninstall: pip Found existing installation: pip 21.3.1 Uninstalling pip-21.3.1: Successfully uninstalled pip-21.3.1 Successfully installed pip-19.2.3 well the only thing that will work is
python -m pip install pip==
you can and should run it under IDE terminal (mine was pycharm)
1If you have to downgrade pip version do following steps: step1. pip uninstall pip step2. pip install pip==version number you want to install or downgrade step3. check version of pip using pip --version
This process also works when any other package giving error exit code(2) you can follow these steps and install your package.