pip命令

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

若是python3則自帶安裝pip,不須要單獨安裝。ide

  • 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
相關文章
相關標籤/搜索