Skip to main content

Configuration

Virtual environments​

What's this

Here are some configuration that comes in handy

.venv

A virtual environment in Python is crucial as it helps keep projects organized by creating separate spaces for development. This ensures a smooth workflow, avoids conflicts with different parts of the project, and makes version control easier, making Python programming projects more organized and manageable.

To display a list of all installed packages and their versions within the current virtual environment, run the following:

pip freeze

This information is often utilized for documenting dependencies, enabling others to recreate the same development environment with identical package versions.

To export the list in .txt in your project directory:

pip freeze > requirements.txt

Create​

py -m venv .venv

Activate​

.\venv\scripts\activate

Update / Upgrade​

Updating your enviroment libraries to ensure smooth development is considered best practices. Once a requirements.txt is present in your project dir, run the following:

py -m pip install --upgrade -r requirements.txt

To update pip it itself, run the following:

py -m pip install --upgrade pip