Module 9 of 13 · Getting Started with AI Development · Beginner

Installing Python Libraries

Duration: 5 min

What is pip?

pip is Python's package manager. It allows you to install libraries (packages) that extend Python's functionality. For AI development, we'll use libraries like NumPy, Pandas, and scikit-learn.

# Check if pip is installed
pip --version

# Install a library
pip install numpy

# Install multiple libraries
pip install pandas scikit-learn matplotlib

# List installed packages
pip list

Try it in Google Colab: Open in Colab

pip 21.0.1 from /usr/lib/python3.9/site-packages/pip (python 3.9)
Successfully installed numpy-1.21.0
Successfully installed pandas-1.3.0 scikit-learn-0.24.2 matplotlib-3.4.2

Virtual Environments

A virtual environment is an isolated Python installation for each project. This prevents conflicts between different projects that need different library versions.

# Create a virtual environment
python -m venv venv

# Activate it (on macOS/Linux)
source venv/bin/activate

# Activate it (on Windows)
venv\Scripts\activate

# Now install libraries - they go into this venv only
pip install numpy pandas scikit-learn

💡 Tip: Always use virtual environments for projects. It keeps your system Python clean and prevents version conflicts.

❓ What is the main purpose of a virtual environment?

← Previous Continue interactively → Next →

Related Courses