MyInternships.in

Python Modules & Packages

Python pip Package Manager

pip is Python's official package manager — a terminal command that downloads and installs third-party libraries from PyPI so you can reuse other people's code.


What Is pip?

The Python standard library covers a lot, but for things like web frameworks, data science, or automation you need external packages. pip (which stands for "pip installs packages") fetches these from the Python Package Index, PyPI, and installs them for you.

Installing a Package

Open your terminal and run pip install followed by the package name. You can also install a specific version if your project needs one exactly.

Installing packages
Terminal
pip install requests
pip install pandas==2.2.0

Uninstalling a Package

If you no longer need a library, remove it cleanly with pip uninstall so it does not clutter your environment.

Removing a package
Terminal
pip uninstall requests

Listing Installed Packages

pip list shows every package currently installed along with its version — useful for checking what a project already has available.

Listing packages
Terminal
pip list

pip freeze and requirements.txt

pip freeze prints your installed packages in a format that can be saved into a requirements.txt file. Anyone cloning your project can then install the exact same versions with one command, which is essential for teamwork and deployment.

Creating and using requirements.txt
Terminal
pip freeze > requirements.txt
pip install -r requirements.txt
💡

Always create requirements.txt inside a virtual environment, not your global Python install, so it only lists packages your project actually needs.

CommandPurpose
pip install <pkg>Install the latest version
pip install <pkg>==1.2.0Install an exact version
pip uninstall <pkg>Remove a package
pip listShow installed packages
pip freezePrint installed packages with versions
pip install -r requirements.txtInstall everything listed in the file

Frequently Asked Questions

Do I need to install pip separately?+

No. Since Python 3.4, pip comes bundled with every standard Python installation, so it is ready to use as soon as Python is installed.

What is the difference between pip list and pip freeze?+

pip list gives a human-readable table, while pip freeze outputs a package==version format that can be pasted straight into requirements.txt.

Why do my teammates need requirements.txt?+

It guarantees everyone installs the exact same package versions, avoiding "it works on my machine" bugs caused by version mismatches.

Related Python Topics

Keep learning with these closely related lessons.

Ready to use your Python skills?

Find Python, data science and software internships and fresher jobs across India.

Browse Python Internships