Tuesday 21 April 2015

Introduction to PIP

pip is a package management system used to install and manage software packages written in Python.


Diffrent pip commands are given bellow:

1)
First, we have to Install pip.
    $ sudo apt-get install python-pip

2)
Install a package using pip
    anusree@anusree-VirtualBox:~$ sudo pip install django
    [sudo] password for anusree:
    Downloading/unpacking django
      Downloading Django-1.8-py2.py3-none-any.whl (6.2MB): 6.2MB downloaded
    Installing collected packages: django
    Successfully installed django
    Cleaning up...


3)
command to Show what files are installed:
    anusree@anusree-VirtualBox:~$ pip show --files django
    ---
    Name: Django
    Version: 1.8
    Location: /usr/local/lib/python2.7/dist-packages
    Requires:
    Files:
    Cannot locate installed-files.txt


4)
List what packages are outdated:
    $ pip list --outdated

5)Upgrade a package:
    anusree@anusree-Inspiron-5547:~$ sudo pip install --upgrade django
    [sudo] password for anusree:
    Downloading/unpacking django
      Downloading Django-1.8-py2.py3-none-any.whl (6.2MB): 6.2MB downloaded
    Installing collected packages: django
    Successfully installed django
    Cleaning up...


6)
If you want to unintall a package
    $ pip uninstall PackageName

7)
If you want to upgrade the pip then the command is given bellow
    pip install -U pip

8)
To list installed packages:

    anusree@anusree-VirtualBox:~$ pip list
    adium-theme-ubuntu (0.3.4)
    apt-xapian-index (0.45)
    argparse (1.2.1)
    chardet (2.0.1)
    colorama (0.2.5)
    command-not-found (0.3)

    .
    .
    .


9)
If you want to search a package the command if given bellow:
    anusree@anusree-VirtualBox:~$ pip search django
    django-swstags            - UNKNOWN
    django-ptree              - pTree is a Django toolset that makes it easy to create and administer web-based social science experiments.
    django_backstage          - Django project and site deployment using virtualenv, uWSGI, nginx, etc.
    adrest                    - Adrest - Another Django REST. Simple application for quick build REST API.
    django-buckeye-corpus     - UNKNOWN
    django-facebook           - Facebook open graph API client in python. Enables django applications to register users using facebook. Fixes issues with
                                    the official but unsupported Facebook python-sdk. Enables mobile facebook authentication. Canvas page authentication for
                                    facebook applications. FQL access via the server side api.
    askbot                    - Question and Answer forum, like StackOverflow, written in python and Django
    django-libs               - A collection of things that we re-use in every Django project, such as custom middlewares, testrunner, templates,
    .
    .
    .
    .

   

10)
If you want to know about pip then type the command
    anusree@anusree-VirtualBox:~$ pip --help
            or   
    anusree@anusree-VirtualBox:~$ pip -h

    Usage:  
      pip <command> [options]

    Commands:
        install                     Install packages.
        uninstall                   Uninstall packages.
        freeze                      Output installed packages in requirements format.
        list                        List installed packages.
        show                        Show information about installed packages.
        search                      Search PyPI for packages.
        wheel                       Build wheels from your requirements.
        zip                         DEPRECATED. Zip individual packages.
        unzip                       DEPRECATED. Unzip individual packages.
        bundle                      DEPRECATED. Create pybundles.
        help                        Show help for commands.

    General Options:
        -h, --help                  Show help.
        -v, --verbose              Give more output. Option is additive, and can be used up to 3 times.
        -V, --version               Show version and exit.
        -q, --quiet                  Give less output.
        --log-file <path>         Path to a verbose non-appending log, that only logs failures. This log is active by default at
                              /home/anusree/.pip/pip.log.
        --log <path>              Path to a verbose appending log. This log is inactive by default.
        --proxy <proxy>          Specify a proxy in the form [user:passwd@]proxy.server:port.
        --timeout <sec>           Set the socket timeout (default 15 seconds).
        --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.
        --cert <path>               Path to alternate CA bundle.





























No comments:

Post a Comment