pip命令

原文链接地址:https://pip.pypa.io/en/latest/user_guide/

如果python3则自带安装pip,不需要单独安装。

  • pip安装包
$ pip install SomePackage
[...]
Successfully installed SomePackage
$ pip install SomePackage            # latest version
$ pip install SomePackage==1.0.4     # specific version
$ pip install 'SomePackage>=1.0.4'     # minimum version
  • pip从其他地方获取包
$ pip install SomePackage-1.0-py2.py3-none-any.whl
[...]
Successfully installed SomePackage
pip install -r requirements.txt
pip freeze > requirements.txt
  • pip显示安装的包
$ pip show --files SomePackage
Name: SomePackage
Version: 1.0
Location: /my/env/lib/pythonx.x/site-packages
Files:
  ../somepackage/__init__.py
  [...]
$ pip list
docutils (0.9.1)
Jinja2 (2.6)
Pygments (1.5)
Sphinx (1.1.2)
  • pip列出过时包
$ pip list --outdated
SomePackage (Current: 1.0 Latest: 2.0)
  • pip升级包
$ pip install --upgrade SomePackage
[...]
Found existing installation: SomePackage 1.0
Uninstalling SomePackage:
  Successfully uninstalled SomePackage
Running setup.py install for SomePackage
Successfully installed SomePackage
  • pip卸载包
$ pip uninstall SomePackage
Uninstalling SomePackage:
  /my/env/lib/pythonx.x/site-packages/somepackage
Proceed (y/n)? y
Successfully uninstalled SomePackage
posted @ 2019-05-27 21:41  wuyuan2011woaini  阅读(270)  评论(0编辑  收藏  举报