Skip to main content
Vibe Code Forum

Article: Python, pip and virtual environments in plain English

Python is the most popular language for scripts, data work, automations and AI projects. If your idea is "process these files", "pull data from this API every morning" or "analyse this spreadsheet", the AI will probably suggest Python.

The pieces

  • Python: the language and the program that runs .py files.
  • pip: installs packages (libraries) such as requests for web requests or pandas for spreadsheets. Newer tools such as uv do the same job faster.
  • Virtual environment (venv): a private folder of packages for one project, so projects don't clash. Always use one.
  • requirements.txt or pyproject.toml: the list of packages a project needs.

Setting up a project

python -m venv .venv            create the environment (use python3 on Mac and Linux)
.venv\Scripts\activate          switch it on (Windows)
source .venv/bin/activate       switch it on (Mac and Linux)
pip install -r requirements.txt install what the project needs
python main.py                  run it

When the environment is on, your terminal usually shows (.venv) at the start of the line. If a script says a module is missing, the environment probably isn't switched on.

Add .venv/ to your .gitignore; it should never be committed.

Ways to run Python without installing anything

  • Google Colab and other online notebooks run Python in the browser, good for data and experiments.
  • Chat assistants can often run Python themselves to analyse a file you upload.

Prompts that work

  • "Write a Python script that reads sales.csv and makes a chart of monthly totals. Use a virtual environment, list the packages in requirements.txt, and tell me the exact commands to run it on Windows."
  • "Explain what each line of this script does."

Running it on a schedule

On your own computer: Task Scheduler (Windows) or cron (Mac and Linux). In the cloud: a scheduled job on your hosting provider, or a scheduled workflow in GitHub Actions. Ask your AI tool for the steps for the one you choose, and remember the script's keys go in environment variables. See Environment variables and .env files.

Read next: The terminal without fear: the commands you actually need and Environment variables and .env files: where secrets go.

More in Tools explained