Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Hawkhobo/AvenueDB

Repository files navigation

AvenueDB-165a-winter-2025

How to Use Python's Virtual Environment (venv)

This guide will walk you through creating and using Python's built-in virtual environment (venv) for isolating project dependencies.

What is venv?

venv is a tool that allows you to create isolated environments for your Python projects. Each virtual environment has its own Python executable and can have its own set of libraries, independent of the system-wide Python installation. This helps prevent version conflicts between different projects.

Prerequisites

  • Python 3.3+: venv is included in Python 3.3 and later.
  • pip: The Python package installer should be installed alongside Python.

Steps to Create and Use a Virtual Environment

1. Install Python (if not installed)

Make sure you have Python 3 installed on your system. You can check by running:

python3 --version  # macOS/Linux
python --version   # Windows

2. Install Venv (if not installed)

Install virtualenv

pip3 install virtualenv  # macOS/Linux
pip install virtualenv   # Windows

3. Create a New Virtual Environment

Navigate to your project directory and create a new virtual environment with the following command:

On MacOS

python3 -m venv venv

On Windows

python -m venv venv

This command creates a folder named venv in your project directory that contains a fresh Python environment.

4. Activate the Virtual Environment

Once your environment is created, you need to activate it:

On macOS/Linux:

source venv/bin/activate

On Windows:

venv\Scripts\activate

When the virtual environment is activated, your shell prompt will change to show the name of the virtual environment, like so:

(venv) user@machine:path/to/project$

5. Install Dependencies Inside the Virtual Environment

Once the virtual environment is activated, you can install Python packages using pip:

On MacOS

pip3 install <package-name>

On Windows

pip install <package-name>

6. To Exit Virtual Environment

deactivate

About

L-Store: A Real-time OLTP and OLAP Database Management System

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5

Languages