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: Rakesh
Author Info:

Rakesh is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

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