PythonWindowsPip4 min read

Install Python on Windows Server

Install Python on Windows Server with pip and virtual environments for scripts and applications.


Python is widely used for automation, web applications and data processing. This guide covers installation on Windows Server.

Method 1 — Official installer (recommended)

Download and install Python:

powershell
# Download Python installer
Invoke-WebRequest -Uri "https://www.python.org/ftp/python/3.12.1/python-3.12.1-amd64.exe" -OutFile "C:\temp\python-installer.exe"

# Silent install with PATH
C:\temp\python-installer.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0

Method 2 — Using winget

powershell
winget install Python.Python.3.12

Method 3 — Using Chocolatey

powershell
choco install python --version=3.12.1 -y

Verify the installation

Open a new PowerShell window:

powershell
python --version
pip --version

Add to PATH (if needed)

powershell
$pythonPath = "C:\Program Files\Python312;C:\Program Files\Python312\Scripts"
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$pythonPath", "Machine")

Create a virtual environment

powershell
mkdir C:\apps\myproject
cd C:\apps\myproject
python -m venv venv

Activate the virtual environment:

powershell
.\venv\Scripts\Activate.ps1

If you get an execution policy error:

powershell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Install packages

powershell
pip install flask gunicorn requests
pip freeze > requirements.txt
pip install -r requirements.txt

Deactivate the environment

powershell
deactivate

Run a Python web application

powershell
# Install Flask
pip install flask

# Create app.py
Set-Content -Path "C:\apps\myproject\app.py" -Value "from flask import Flask`napp = Flask(__name__)`n@app.route('/')`ndef hello():`n    return 'Hello from Baires Host!'`nif __name__ == '__main__':`n    app.run(host='0.0.0.0', port=5000)"

# Run
python app.py

Tip

For production Python web apps on Windows, use IIS with the wfastcgi module or run behind IIS as a reverse proxy. Always use virtual environments to isolate project dependencies on your Baires Host VPS.


Was this guide helpful?