This guide explains how to install Python on Windows, verify the installation, create a project, set up a virtual environment, and understand what a virtual environment does and why it is useful.
Python is a popular programming language used for web development, automation, data analysis, machine learning, and more.
A virtual environment (venv) is an isolated Python environment created for a specific project.
It contains:
- Its own Python interpreter
- Its own installed packages (libraries)
Virtual environments help you:
- Avoid dependency conflicts between projects
- Use different versions of the same package
- Keep your system Python installation clean
- Reproduce the same setup on another machine
Without virtual environments, all projects share the same packages, which can lead to version conflicts.
- Download Python from:
https://www.python.org/downloads/windows/ SELECT -> Download Windows installer (64-bit) - Run the installer.
- Check the box ✅ Add Python to PATH
- Click Install Now and complete the installation.
Open Command Prompt and run:
python --versionThis should give you something like this: Python 3.x.x
- pip is Python’s package manager. It is installed automatically with Python.
pip --version
It should look something like this:
- pip x.x.x from C:\Python\Lib\site-packages\pip (python 3.x)
Navigate to where you want your project and create a folder:
cd my_project
In your command line you should be in your project like this: C:\path\to\my_project>
python -m venv venv
A folder called venv should be added to the project folder
venv\Scripts\activate
In your command line the path should look like this: (venv) C:\path\to\my_project>
You can do this by installing them seperately with commands like:
pip install pandas
Or you can do this by installing all of them from a requirements.txt. You can try this out by downloading the requirements.txt example from this github.
pip install -r requirements.txt
You can easily add all installed libraries to a requirements.txt with the following command:
pip freeze > requirements.txt
If you want to exit the virtual enviroment you can easliy do this by typing:
deactivate in the command line