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.

1
  • 2
    pip default version is Python 3. You can use pip2 for using pip of Python 2.x. Hope that this answer: stackoverflow.com/a/11272201 helps you. Commented Jul 7, 2020 at 9:25

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.