#1 Data Analytics Program in India
₹2,499₹1,499Enroll Now
4 min read

Installing Python Packages

Learn how to add new tools to Python using pip

What You'll Learn

  • What are Python packages
  • How to install packages with pip
  • Installing packages you'll use for data analysis

What are Packages?

Think of packages like apps on your phone. Python comes with basic tools, but packages add extra features.

Examples:

  • pandas - Work with data tables
  • matplotlib - Create charts and graphs
  • requests - Get data from websites

Installing Packages with pip

pip is like an app store for Python. It comes automatically when you install Python.

Basic Command

$ terminalBash
pip install pandas

That's it! Just type this in your terminal/command prompt.

Step by Step

Windows:

  1. Press Windows key
  2. Type "cmd" and press Enter
  3. Type: pip install pandas
  4. Press Enter
  5. Wait for it to finish

Mac:

  1. Press Cmd + Space
  2. Type "terminal" and press Enter
  3. Type: pip install pandas
  4. Press Enter
  5. Wait for it to finish

Google Colab: You don't need to install anything! Most packages are already there. If you need one:

code.pyPython
!pip install package-name

Notice the ! at the beginning - that's important in Colab!

Essential Packages for Data Analysis

Install these packages to start working with data:

$ terminalBash
pip install pandas
pip install matplotlib
pip install numpy

Or install all at once:

$ terminalBash
pip install pandas matplotlib numpy

Using Installed Packages

After installing, you need to import them in your Python code:

code.pyPython
import pandas
import matplotlib
import numpy

print("All packages loaded!")

Common Questions

Q: How do I know if a package is installed?

Try importing it:

code.pyPython
import pandas

If you get an error, it's not installed.

Q: Do I need to install packages every time?

No! Install once, use forever (until you reinstall Python).

Q: What if I get an error?

Try:

$ terminalBash
pip3 install pandas

Use pip3 instead of pip on Mac/Linux.

Quick Reference

Install a package:

$ terminalBash
pip install package-name

Install multiple packages:

$ terminalBash
pip install pandas numpy matplotlib

Check what's installed:

$ terminalBash
pip list

Update a package:

$ terminalBash
pip install --upgrade package-name

What's Next?

Now that you can install packages, let's learn Python basics!