pip基本命令
-
Install a Package:
- Command:
pip install package_name - Usage: Installs the specified package. You can also specify a version number with
package_name==version_number.
- Command:
-
Install Packages from a Requirements File:
- Command:
pip install -r requirements.txt - Usage: Installs all the packages listed in the specified requirements file (
requirements.txtis a common filename).
- Command:
-
Upgrade a Package:
- Command:
pip install --upgrade package_name - Usage: Upgrades the specified package to the latest version.
- Command:
-
Uninstall a Package:
- Command:
pip uninstall package_name - Usage: Uninstalls the specified package from the environment.
- Command:
-
List Installed Packages:
- Command:
pip list - Usage: Lists all packages installed in the current environment along with their versions.
- Command:
-
Show Information about a Package:
- Command:
pip show package_name - Usage: Displays detailed information about a specific package, including its version, dependencies, and location.
- Command:
-
Search for a Package:
- Command:
pip search search_term - Usage: Searches the Python Package Index (PyPI) for packages whose name or summary contains the search term.
- Command:
-
Freeze Installed Packages:
- Command:
pip freeze - Usage: Outputs a list of all installed packages in a requirements format. Often used to create a
requirements.txtfile.
- Command:
-
Check for Packages with Known Issues:
- Command:
pip check - Usage: Checks for installed packages with known issues, such as broken dependencies.
- Command:
-
Download a Package:
- Command:
pip download package_name - Usage: Downloads a package and its dependencies but does not install them.
- Command:
-
Install a Package at a Specific Version:
- Command:
pip install package_name==version_number - Usage: Installs a specific version of a package.
- Command:
-
Upgrade pip Itself:
- Command:
pip install --upgrade pip - Usage: Upgrades pip to the latest version.
- Command:

浙公网安备 33010602011771号