Skip to main content

Python Setup Guide

This guide will walk you through the process of setting up Python on your computer.

Installing Python

Windows

To install Python on Windows, follow these steps:

  1. Download the latest version of Python from the official website.
  2. Run the installer and follow the prompts to install Python.

Mac

To install Python on Mac, follow these steps:

  1. Open Terminal and type brew install python.
  2. Press Enter and wait for the installation to complete.

Setting Up a Virtual Environment

A virtual environment is a tool that allows you to create an isolated Python environment for your project. This is useful for managing dependencies and avoiding conflicts with other projects.

To set up a virtual environment, follow these steps:

  1. Open Terminal or Command Prompt and navigate to the directory where you want to create your project.
  2. Type python -m venv env to create a new virtual environment.
  3. Activate the virtual environment by typing source env/bin/activate on Mac/Linux or .\env\Scripts\activate on Windows.

Installing Python Packages

Once you have set up your virtual environment, you can use pip to install Python packages. For example, to install the Flask web framework, you can type pip install Flask.