快速指南

优质
小牛编辑
135浏览
2023-12-01

首先,安装 pip,从 PyPI 安装:

$ pip install SomePackage
  [...]
  Successfully installed SomePackage

查看什么package被安装:

$ pip show --files SomePackage
  Name: SomePackage
  Version: 1.0
  Location: /my/env/lib/pythonx.x/site-packages
  Files:
   ../somepackage/__init__.py
   [...]

查看什么package有更新:

$ pip list --outdated
  SomePackage (Current: 1.0 Latest: 2.0)

更新新的package:

$ pip install --upgrade SomePackage
  [...]
  Found existing installation: SomePackage 1.0
  Uninstalling SomePackage:
    Successfully uninstalled SomePackage
  Running setup.py install for SomePackage
  Successfully installed SomePackage

卸载已有package:

$ pip uninstall SomePackage
  Uninstalling SomePackage:
    /my/env/lib/pythonx.x/site-packages/somepackage
  Proceed (y/n)? y
  Successfully uninstalled SomePackage