Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do 3 pip modules exist after a virtual environment created?

After creating a virtual environment, I found three pip modules:

pip, pip3, pip3.6

What's the purpose of the redundancy?

like image 782
AbstProcDo Avatar asked Feb 17 '26 03:02

AbstProcDo


1 Answers

The redundancy gives you access to the version specific pip binary when you have multiple Python versions installed. Python does the same, you have python3 and python3.6 binaries, perhaps even a python binary (*) that points to the same version.

If you were to install, say, Python 2.7, you'd have python, python2 perhaps (*), and python2.7. Similarly, pip installed into Python 2.7 would at least give you pip2 and pip2.7 versions too.

In a virtualenv this may not make much of a difference, but in theory you could add the bin directory of the virtualenv directory to your PATH variable, at which point typing in pip could find the binary in the virtualenv or in a different directory, but pip3.6 would be much more specific.


(*) Whether or not Python 2 is available as python2, or Python 3 is available as python is something the OS packagers decide, or if you are in a virtualenv. Traditionally, Python 2 has not been installed under python2 but some systems have made this switch and make python point to a Python 3 release by default.

like image 97
Martijn Pieters Avatar answered Feb 19 '26 17:02

Martijn Pieters



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!