zoukankan      html  css  js  c++  java
  • python包管理工具pip

    Introduction

    pip installs packages. Python packages.

    If you use virtualenv -- a tool for installing libraries in a local and isolated manner -- you'll automatically get a copy of pip. Free bonus!

    Once you have pip, you can use it like this:

    $ pip install SomePackage

    SomePackage is some package you'll find on PyPI. This installs the package and all its dependencies.

    pip does other stuff too, with packages, but install is the biggest one. You can pip uninstall too.

    You can also install from a URL (that points to a tar or zip file), install from some version control system (use URLs like hg+http://domain/repo -- or prefix git+, svn+ etc). pip knows a bunch of stuff about revisions and stuff, so if you need to do things like install a very specific revision from a repository pip can do that too.

    If you've ever used python setup.py develop, you can do something like that with pip install -e ./ -- this works with packages that use distutils too (usually this only works with Setuptools projects).

    You can use pip install --upgrade SomePackage to upgrade to a newer version, or pip install SomePackage==1.0.4 to install a very specific version.

    Pip Compared To easy_install

    pip is a replacement for easy_install. It uses mostly the same techniques for finding packages, so packages that were made easy_installable should be pip-installable as well.

    pip is meant to improve on easy_install. Some of the improvements:

    All packages are downloaded before installation. Partially-completed installation doesn't occur as a result.Care is taken to present useful output on the console.The reasons for actions are kept track of. For instance, if a package is being installed, pip keeps track of why that package was required.Error messages should be useful.The code is relatively concise and cohesive, making it easier to use programmatically.Packages don't have to be installed as egg archives, they can be installed flat (while keeping the egg metadata).Native support for other version control systems (Git, Mercurial and Bazaar)Uninstallation of packages.Simple to define fixed sets of requirements and reliably reproduce a set of packages.

    pip doesn't do everything that easy_install does. Specifically:

    It cannot install from eggs. It only installs from source. (In the future it would be good if it could install binaries from Windows .exe or .msi -- binary install on other platforms is not a priority.)It doesn't understand Setuptools extras (like package[test]). This should be added eventually.It is incompatible with some packages that extensively customize distutils or setuptools in their setup.py files.

    pip is complementary with virtualenv, and it is encouraged that you use virtualenv to isolate your installation.

    Community

    The homepage for pip is temporarily located on PyPI -- a more proper homepage will follow. Bugs can go on the pip issue tracker. Discussion should happen on the virtualenv email group.

    Uninstall

    pip is able to uninstall most installed packages with pip uninstall package-name.

    Known exceptions include pure-distutils packages installed with python setup.py install (such packages leave behind no metadata allowing determination of what files were installed), and script wrappers installed by develop-installs (python setup.py develop).

    pip also performs an automatic uninstall of an old version of a package before upgrading to a newer version, so outdated files (and egg-info data) from conflicting versions aren't left hanging around to cause trouble. The old version of the package is automatically restored if the new version fails to download or install.

  • 相关阅读:
    Android 从零开始打造异步处理框架
    Android 如何有效的解决内存泄漏的问题
    Android 弱引用和软引用
    Python 环境搭建,开发工具,基本语法
    Android 急速发布项目到 JitPack
    GitHub 实现多人协同提交代码并且权限分组管理
    Android 6.0 权限管理最佳实践
    Android Json处理框架
    Android Gson的使用总结
    Android 图片压缩、照片选择、裁剪,上传、一整套图片解决方案
  • 原文地址:https://www.cnblogs.com/imouren/p/2413215.html
Copyright © 2011-2022 走看看