Skip to content

Python Tips

This guide outlines the process of creating a directory, accessing it, setting up a Python virtual environment (.venv), and activating it.

Note

In Windows, the Python command is python, while in macOS and Linux systems it might be python3. Throughout this guide, we'll use python, but if you're on macOS or Linux and the command doesn't work, try using python3 instead.

Setup a new Python Project

  1. Open the terminal and navigate to the directory that you want to initialize.

  2. Create a Virtual Environment (.venv)

    Inside the directory, create a Python virtual environment using the command:

    bash
    python -m venv .venv

    The virtual environment will be created in the .venv directory.

  3. Activate the virtual environment using the appropriate command for your operating system:

    powershell
    .venv\Scripts\activate
    shell
    source .venv/bin/activate

    Once activated, the virtual environment's name (.venv) will appear at the beginning of the terminal prompt.

    If you close the terminal session and starts a new one, please activate the environment again.


    You are now ready to install dependencies and start developing your Python project!