Bottom Page

Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 What's the difference between pip and pip3?
#1
Pip is for python version less than 3.
and pip3 is used when you want to install packages for python version 3 or higher.
Is this correct?
Huh
Quote
#2
Yes it is true on systems such as linux which have python 2 and python 3 installed, but you can invoke pip through the python interpreter by using the syntax python -m pip. For example you can install lxml with the command
Output:
python -m pip install lxml
instead of pip install lxml. If 'python' is the command for python 2, this installs lxml for python 2. If 'python3' is the command for python 3, you can use
Output:
python3 -m pip install lxml
in order to install it for python 3.
Quote
#3
(Sep-13-2018, 05:04 AM)Gribouillis Wrote: Yes it is true on systems such as linux which have python 2 and python 3 installed, but you can invoke pip through the python interpreter by using the syntax python -m pip. For example you can install lxml with the command
Output:
python -m pip install lxml
instead of pip install lxml. If 'python' is the command for python 2, this installs lxml for python 2. If 'python3' is the command for python 3, you can use
Output:
python3 -m pip install lxml
in order to install it for python 3.

Thank you.

what's the difference in this examle?

python3 -m pip install virtualenv

and

pip install virtualenv

Are they the same thing?
Quote
#4
(Sep-13-2018, 04:43 PM)magic Wrote: Thank you.

what's the difference in this examle?

python3 -m pip install virtualenv

and

pip install virtualenv

Are they the same thing?

IF python3 is your only python and python3 and python can both start it, then there is no difference. If python starts legacy python and python3 starts, well, python 3 then pip will install for legacy python and pip3 or your python3 example will install for python 3.
I am trying to help you, really, even if it doesn't always seem that way
Quote
#5
Test with pip -V or pip2 -V | pip3 -V
It's so simple that if pip3 point to Python 3,then pip3 will install to Python 3.
Linux Mint 19:
tom@tom-VirtualBox:~$ pip2 -V
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)

tom@tom-VirtualBox:~$ pip3 -V
pip 18.0 from /home/tom/.local/lib/python3.6/site-packages/pip (python 3.6)

# Install to Python 2
tom@tom-VirtualBox:~$ pip2 install lxml

# Install to Python 3
tom@tom-VirtualBox:~$ pip3 install --user lxml
Collecting lxm
.... lxml-4.2.5-cp36-cp36m-manylinux1_x86_64.whl
Installing collected packages: lxml
Successfully installed lxml-4.2.5

# Test that it work:
tom@tom-VirtualBox:~$ python3
Python 3.6.5 (default, Apr  1 2018, 05:46:30) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from lxml import etree
>>> etree.__version__
'4.2.5'
For Windows:
Python 3.6/3.7 and pip installation under Windows
Here do pip pip3 and pip3.7 all point to main version in Path.
All other version install can be run/install to with py command.
C:\>pip -V
pip 18.0 from c:\python37\lib\site-packages\pip (python 3.7)

C:\>pip3 -V
pip 18.0 from c:\python37\lib\site-packages\pip (python 3.7)

C:\>pip3.7 -V
pip 18.0 from c:\python37\lib\site-packages\pip (python 3.7)

# Other versions use py
C:\                                                                                                            
λ py -3.6 -V                                                                                                   
Python 3.6.4                                                        
                                                      
C:\                                                                                                            
λ py -2.7 -V                                                                                                   
Python 2.7.9                                                                                                   
                                                                                                                
C:\                                                                                                            
λ # Using pip to install to 2.7                                                                            
λ py -2.7 -m pip install logzero                                                                               
Requirement already satisfied: logzero in c:\python27\lib\site-packages
Quote
#6
(Sep-13-2018, 06:35 PM)snippsat Wrote: Test with pip -V or pip2 -V | pip3 -V
It's so simple that if pip3 point to Python 3,then pip3 will install to Python 3.
Linux Mint 19:
tom@tom-VirtualBox:~$ pip2 -V
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)

tom@tom-VirtualBox:~$ pip3 -V
pip 18.0 from /home/tom/.local/lib/python3.6/site-packages/pip (python 3.6)

# Install to Python 2
tom@tom-VirtualBox:~$ pip2 install lxml

# Install to Python 3
tom@tom-VirtualBox:~$ pip3 install --user lxml
Collecting lxm
.... lxml-4.2.5-cp36-cp36m-manylinux1_x86_64.whl
Installing collected packages: lxml
Successfully installed lxml-4.2.5

# Test that it work:
tom@tom-VirtualBox:~$ python3
Python 3.6.5 (default, Apr  1 2018, 05:46:30) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from lxml import etree
>>> etree.__version__
'4.2.5'
For Windows:
Python 3.6/3.7 and pip installation under Windows
Here do pip pip3 and pip3.7 all point to main version in Path.
All other version install can be run/install to with py command.
C:\>pip -V
pip 18.0 from c:\python37\lib\site-packages\pip (python 3.7)

C:\>pip3 -V
pip 18.0 from c:\python37\lib\site-packages\pip (python 3.7)

C:\>pip3.7 -V
pip 18.0 from c:\python37\lib\site-packages\pip (python 3.7)

# Other versions use py
C:\                                                                                                            
λ py -3.6 -V                                                                                                   
Python 3.6.4                                                        
                                                      
C:\                                                                                                            
λ py -2.7 -V                                                                                                   
Python 2.7.9                                                                                                   
                                                                                                                
C:\                                                                                                            
λ # Using pip to install to 2.7                                                                            
λ py -2.7 -m pip install logzero                                                                               
Requirement already satisfied: logzero in c:\python27\lib\site-packages

Thank you. Smile
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Call pip3 from python folder build by me call pip3 from the /usr/bin Suryavarman 3 178 Oct-07-2019, 10:23 PM
Last Post: Suryavarman
  Installed Python3.7 from package, trying to run pip3.7 does not work JBristow1729 4 1,113 Aug-11-2019, 08:24 AM
Last Post: michaellossagk
  pip3 install functools failed kintarowonders 1 1,266 Mar-07-2019, 07:56 PM
Last Post: nilamo

Forum Jump:


Users browsing this thread: 1 Guest(s)