python包管理工具pip的下载_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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值