How to Install Python PIP on Debian

Posted on July 31, 2019 at 11:54 am

To manage Python packages you can use PIP.

To install Python2 PIP just type:

apt-get install python-pip  #python 2

To install Python3 PIP just type:

apt-get install python-pip3 #python 3
apt-get install python3-pip #python 3

Here is an example on how to use PIP:

pip install packageName
pip uninstall packageName
pip search packageName

For Python3 just uses pip3, i.e:

pip3 install packageName

For example, to install dnspython module:

root@server ~ # pip install dnspython
Collecting dnspython
  Downloading (188kB)
    100% |████████████████████████████████| 194kB 2.6MB/s
Installing collected packages: dnspython
Successfully installed dnspython-1.16.0

Here is an example on how to import a module in a script:

import dns.resolver
myResolver = dns.resolver.Resolver()
myResolver.nameservers = ['', '']
        myAnswers = myResolver.query("", "A")
        for rdata in myAnswers:
                print rdata
        print "Query failed"

Updated on March 2, 2020 at 12:49 pm

Receive updates via email

Other Posts

Updated Posts