How to Set Up a Python Development Environment Using 30 Days of Python

The 30 Days of Python repository includes a comprehensive Day 23 lesson that teaches you how to create isolated Python development environments using virtualenv, complete with cross-platform activation commands and dependency management workflows.

The Asabeneh/30-Days-Of-Python repository offers structured guidance for setting up a Python development environment through its dedicated virtual environment module. According to the source code and documentation in 23_Day_Virtual_environment/23_virtual_environment.md, the curriculum provides platform-specific instructions for creating isolated workspaces that prevent package conflicts across the 30-day learning path.

Setting Up a Python Development Environment

Locating the Documentation

The primary resource for environment configuration resides in 23_Day_Virtual_environment/23_virtual_environment.md. This file contains the complete walkthrough for establishing clean, project-specific Python environments using virtualenv and the built-in venv module.

Step-by-Step Environment Configuration

The repository outlines a seven-step process for setting up your development workspace:

  1. Install virtualenv globally using pip:

    pip install virtualenv
  2. Create a project directory to house your environment and code:

    mkdir flask_project && cd flask_project
  3. Initialize the virtual environment using platform-specific commands:

    • macOS/Linux: virtualenv venv
    • Windows: python -m venv venv
  4. Activate the environment based on your operating system and shell:

    • macOS/Linux: source venv/bin/activate
    • Windows PowerShell: venv\Scripts\activate
    • Windows Git Bash: venv\Scripts\. activate
  5. Install project dependencies using pip while the environment is active:

    pip install Flask
  6. Verify installed packages to confirm the isolated environment is working:

    pip freeze
  7. Deactivate the environment when finished:

    deactivate

Managing Project Dependencies

The repository demonstrates dependency management through the python_for_web/requirements.txt file located in the python_for_web directory. After activating your virtual environment, you can install all required packages for the Flask example project using this requirements file, ensuring consistent versions across different development machines.

Running the Example Flask Application

Once your environment is active, you can execute the sample application provided in python_for_web/app.py. The repository includes a minimal Flask implementation that renders HTML templates from the python_for_web/templates/ directory:

from flask import Flask, render_template

app = Flask(__name__)

@app.route("/")
def home():
    return render_template("home.html")

if __name__ == "__main__":
    app.run(debug=True)

Run the application inside your activated environment:

python app.py

Summary

  • The 30 Days of Python repository provides specific guidance for setting up a Python development environment in 23_Day_Virtual_environment/23_virtual_environment.md.
  • Use virtualenv or venv to create isolated project environments that prevent package version conflicts.
  • Activation commands differ by platform: source venv/bin/activate for macOS/Linux versus venv\Scripts\activate for Windows PowerShell.
  • The python_for_web/requirements.txt file demonstrates standard Python dependency management practices.
  • Always verify your environment with pip freeze and exit with deactivate when finished.

Frequently Asked Questions

Does 30 Days of Python include instructions for Windows users?

Yes, the Day 23 guide provides specific commands for Windows environments, including PowerShell activation (venv\Scripts\activate) and Git Bash activation (venv\Scripts\. activate), alongside the standard macOS and Linux instructions. These platform-specific directions ensure developers on any operating system can successfully isolate their Python projects.

Where can I find the virtual environment lesson in the repository?

The complete environment setup tutorial is located at 23_Day_Virtual_environment/23_virtual_environment.md in the repository root, which covers installation, activation, and deactivation procedures. This dedicated lesson provides the foundation for managing dependencies throughout the 30-day curriculum.

How does the repository handle package dependencies?

The curriculum demonstrates dependency management through the python_for_web/requirements.txt file, showing how to install project-specific packages like Flask within an isolated environment using pip install. This approach ensures that each day's exercises maintain clean dependency trees without interfering with system-wide Python installations.

Can I use the built-in venv module instead of virtualenv?

Yes, according to the source materials, Windows users can create environments using python -m venv venv instead of installing the separate virtualenv package, though both methods create functionally identical isolated environments. The repository explicitly mentions both approaches in the Day 23 documentation to accommodate different user preferences and Python versions.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →