Python Package management tool (PIP)

Source: Internet
Author: User

1 Preface

pipis a Python package management tool, mainly for installation PyPI on the package, can replace the easy_install tool.

    • Github:https://github.com/pypa/pip
    • doc:https://pip.pypa.io/en/latest/
2 getting Pip2.1 Script installation Pip
$ Curl-o https://raw.github.com/pypa/pip/master/contrib/get-pip.py$ python get-pip.py
2.2 Installing with package management software
$ sudo yum install python-pip$ sudo apt-get install Python-pip
2.3 Update pip
$ pip install-u pip
3 pip Basic use3.1 Installing PyPI software
$ pip Install somepackage  [...]  Successfully installed Somepackage
3.2 Viewing specific installation files
$ pip show--files somepackage  name:somepackage  version:1.0 location  :/my/env/lib/pythonx.x/ Site-packages  Files:   .. /somepackage/__init__.py   [...]
3.3 See which software needs to be updated
$ pip List--outdated  somepackage (current:1.0 latest:2.0)
3.4 Upgrading Packages
$ pip Install--upgrade somepackage  [...]  Found existing Installation:somepackage 1.0  uninstalling Somepackage:    successfully uninstalled somepackage  Running setup.py Install for somepackage  Successfully installed Somepackage
3.5 Uninstalling Packages
$ pip Uninstall somepackage  uninstalling Somepackage:    /my/env/lib/pythonx.x/site-packages/somepackage  Proceed (y/n)? y  Successfully uninstalled Somepackage
4 pip Concise manual4.1 Installing the specific version of the software
$ pip Install somepackage            # latest version$ pip install somepackage==1.0.4     # specific version$ pip install ' Somepa ckage>=1.0.4 '     # Minimum version
4.2 Requirements File installation dependent software

Requirements文件The list of dependent software is generally recorded, and the dependent packages can be installed once by Pip:

$ pip freeze > requirements.txt$ pip install-r requirements.txt
4.3 listing the package list
$ pip list$ pip list--outdatedipython (current:1.2.0 latest:2.3.0)
4.4 Viewing package information
$ pip show pip---name:pipversion:1.4.1location:/library/python/2.7/site-packages/pip-1.4.1-py2.7.eggrequires:$ pip Show Pyopencl---name:pyopenclversion:2014.1location:/library/python/2.7/site-packagesrequires:pytools, Pytest, Decorator
4.5 Search
$ pip Search Pycudapycuda                    -Python wrapper for Nvidia cudapyfft                     -FFT library for Pycuda and Pyopenclcudatree                  -Random forests for the GPU using Pycudareikna                    -GPGPU algorithms for Pycuda and Pyopenclcompyte                   -A Common set O F Compute primitives for Pycuda and PYOPENCL (to be created)
4.6 Configuration Files

Configuration files: $HOME/.pip/pip.conf , for example:

[global]timeout = 60index-url = http://download.zope.org/ppix[install]ignore-installed = Trueno-dependencies = yes
4.7 command Line auto-completion

For bash:

$ pip Completion--bash >> ~/.profile

For zsh:

$ pip Completion--zsh >> ~/.zprofile

After the configuration file is loaded, the PIP command supports auto-complete functionality.

5 PostScript

You should use PIP as much as possible and do not continue using Easy_install.

Python Package management tool (PIP)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.