How to Install Python3 on Windows using PowerShell


If you some reason you want to download and install Python 3.x.x using PowerShell, then you can write your own script as follows.

Script to download Python using PowerShell

# Step 1: get the download link of Python version 3.x.x from the internet
$pythonInstallerUrl = "https://www.python.org/ftp/python/3.9.8/python-3.9.8.exe"

# Step 2: set the PATH where the Python installer will be downloaded.
$pythonSetup = "D:\setup\python-3.9.8.exe"

# Step 3: Download the Pyhton 3.x.x setup file.
Invoke-WebRequest -Uri $pythonInstallerUrl -OutFile $pythonSetup

# Step 4: Install Python with default settings.
Start-Process -Wait -FilePath $pythonSetup -ArgumentList "/quiet", "PrependPath=1"

# Step 5: Remove the setup file (Optional)
Remove-Item -Path $pythonSetup
Steps to download and Install Python using PowerShell

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap