Install Python-Pip on Linux

Python-pip is a Python moduels management package.
Like npm, sbt, bower(mac os), apt-get(linux), Vundle.vim, tpm(tmux plugin manager) and so on.

Use Terminal

  • python2 pip
    1
    $ sudo apt-get install python-pip
  • python3 pip
    1
    $ sudo apt-get install python3-pip

Use Python File

  • Download Pip Install File: get-pip.py
  • Then run the following:
    1
    $ python get-pip.py

Use pip Install Modules

  • Use pip install
    1
    2
    $ pip install url3
    $ pip install Pillow

Use Installed Modules to Program

  • Import Installed Modules
    1
    2
    3
    4
    5
    6
    7
    #coding=utf-8
    import urllib3
    http = urllib3.PoolManager()

    r = http.request('GET', 'http://www.baidu.com/')
    print(r.status)
    print(r.headers['server'])