1

I have both python2 and python3 in my system. But when I try :

python -m pip install sklearn

bash shows :

/usr/bin/python: No module named pip

And

pip --version

Yields :

pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

Python versions are Python 2.7.18 and Python 3.8.2. How to correct this error by having two pip versions?

This is a similar question, but did not solve the issue.

OS is Ubuntu.

Roshin Raphel
  • 2,612
  • 4
  • 22
  • 40
  • 2
    `pip` default version is Python 3. You can use `pip2` for using pip of Python 2.x. Hope that this answer: https://stackoverflow.com/a/11272201/ helps you. – HK boy Jul 07 '20 at 09:25

1 Answers1

2

Thanks to HK boy The following works, it installs pip explicitly for the python version specified :

curl -O https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py

I already had pip3 before hand, so to install packages for python3, pip3 install <package> is enough.

Roshin Raphel
  • 2,612
  • 4
  • 22
  • 40