Python With AI Agent


How to Install Python on Windows (2026 Step-by-Step Guide)

Python is one of the easiest and most popular programming languages in the world. Whether you want to build websites, automate tasks, create desktop applications, or work with artificial intelligence (AI), Python is a great language to learn. It is free, open source, and supported by a large community of developers.

If you're new to programming, this guide will show you how to install Python on Windows step by step. 

  What is Python?

Python is a high-level programming language created by Guido van Rossum and first released in 1991. It is known for its simple syntax, making it an excellent choice for beginners and professionals alike.

Python is used by companies such as Google, Microsoft, Netflix, NASA, and many others for a wide range of applications.

Why learn Python?

Python can be used for many different purposes, including:

  • Web development
  • Artificial Intelligence (AI)
  • Machine Learning
  • Data Science
  • Automation
  • Desktop applications
  • Game development
  • Cybersecurity
  • APIs and web services

Its simple syntax allows beginners to start coding quickly.


System Requirements

Before installing Python, make sure your computer meets these basic requirements:

  • Windows 10 or Windows 11
  • At least 4 GB of RAM (8 GB recommended)
  • Around 500 MB of free disk space
  • Internet connection to download the installer

Step 1: Download Python

Open your web browser and visit the official Python website:

https://www.python.org/downloads/

The website automatically suggests the latest stable version for Windows.

Click the Download Python button.

Download the Windows Installer (64-bit) if your computer uses a 64-bit operating system.

Step 2: Verify the Installation

Open Command Prompt.

Run:

python --version

or

python -V

Example output:

Python 3.x.x

If you see the version number, Python has been installed successfully.


Step 3: Finish Installation

When the installation completes, you'll see:

Setup was successful

Click Close to exit the installer.

Python is now installed on your computer.


Step 4: Verify the Installation

Open Command Prompt.

Run:

python --version

or

python -V

Example output:

Python 3.x.x

If you see the version number, Python has been installed successfully.


Step 5: Check pip

Python automatically installs pip, the package manager used to install Python libraries.

Run:

pip --version

Example:

pip 25.x from ...

Step 6: Create Your First Python Program

Create a file called:

hello.py

Open the file and write:

print("Hello, World!")

Save the file.

Open Command Prompt in the same folder and run:

python hello.py

Output:

Hello, World!

Congratulations! You have written and executed your first Python program.


Connecting to Ollama with the Python Library

Ollama provides a simple Python library that allows developers to communicate with locally running language models. Before using the library, install Ollama, download a model such as llama3, qwen3, or phi3, and make sure the Ollama service is running. After installing the Python package, you can send prompts to the model and receive AI-generated responses directly from your Python application.

Install the Python Library

pip install ollama

Import the Library

import ollama

Generate a Response

import ollama

response = ollama.chat(
    model="llama3",
    messages=[
        {
            "role": "user",
            "content": "Explain what artificial intelligence is."
        }
    ]
)

print(response["message"]["content"])

Generate Text

import ollama

response = ollama.generate(
    model="llama3",
    prompt="Write a paragraph about Python programming."
)

print(response["response"])

List Installed Models

import ollama

models = ollama.list()

print(models)

Pull a Model

import ollama

ollama.pull("phi3")

Delete a Model

import ollama

ollama.delete("phi3")

Connect to the Ollama API

By default, the Python library communicates with the local Ollama API running on:

http://localhost:11434

You can also call the REST API directly using the requests library.

import requests

url = "http://localhost:11434/api/generate"

data = {
    "model": "llama3",
    "prompt": "Hello!",
    "stream": False
}

response = requests.post(url, json=data)

print(response.json()["response"])

The Python library automatically connects to the local Ollama server, making it easy to integrate local language models into desktop applications, web applications, automation tools, and AI assistants.

Comments