# Python Pip and Requirements Files

`pip` is the package installer for Python. You can use it to install packages from the Python Package Index (PyPI) and other indexes.

## Basic Commands

### Install a Package

```bash
pip install package_name
```

### Install a Specific Version

```bash
pip install package_name==1.0.4
```

### Uninstall a Package

```bash
pip uninstall package_name
```

### List Installed Packages

```bash
pip list
```

### Show Package Information

Displays information about a specific package.

```bash
pip show package_name
```

## Requirements Files

Requirements files (`requirements.txt`) are used to specify a list of packages and their versions to be installed. This is crucial for reproducing environments.

### Creating a Requirements File

You can save the list of currently installed packages to a file.

```bash
pip freeze > requirements.txt
```

### Installing from a Requirements File

To install all packages listed in the file:

```bash
pip install -r requirements.txt
```

## Upgrading Packages

To upgrade a package to the newest available version:

```bash
pip install --upgrade package_name
```

## Checking for Outdated Packages

```bash
pip list --outdated
```

[[programming/python/python]]