|
|
|
$url = "https://www.python.org/ftp/python/3.11.9/python-3.11.9-amd64.exe"
|
|
|
|
$output = "python311_installer.exe"
|
|
|
|
$install_dir = "C:\Python311"
|
|
|
|
|
|
|
|
if (!(Test-Path $install_dir)) {
|
|
|
|
Write-Output "Python 3.11 installation not found. Installing..."
|
|
|
|
if (!(Test-Path $output)) {
|
|
|
|
$start_time = Get-Date
|
|
|
|
$wc = New-Object System.Net.WebClient
|
|
|
|
$wc.DownloadFile($url, $output)
|
|
|
|
#OR
|
|
|
|
(New-Object System.Net.WebClient).DownloadFile($url, $output)
|
|
|
|
Write-Output "Python 3.11 Downloaded. Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
|
|
|
|
}
|
|
|
|
Write-Output "Installing Python 3.11 to $install_dir"
|
|
|
|
Start-Process $output -ArgumentList "/quiet","InstallAllUsers=1","TargetDir=$install_dir" -NoNewWindow -Wait
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(Test-Path $install_dir)) {
|
|
|
|
Write-Output "Python 3.11 installation still not found at $install_dir. Please repair your installation"
|
|
|
|
Read-Host -Prompt "Press Enter to continue"
|
|
|
|
}
|
|
|
|
|
|
|
|
Write-Output "Installing packaging"
|
|
|
|
Start-Process "$install_dir\python.exe" -ArgumentList "-m pip install packaging" -Wait
|
|
|
|
|
|
|
|
Write-Output "Installing setuptools"
|
|
|
|
Start-Process "$install_dir\python.exe" -ArgumentList "-m pip install setuptools" -Wait
|
|
|
|
|
|
|
|
Write-Output "Installing requests"
|
|
|
|
Start-Process "$install_dir\python.exe" -ArgumentList "-m pip install requests" -Wait
|
|
|
|
|
|
|
|
Write-Output "Installing chardet"
|
|
|
|
Start-Process "$install_dir\python.exe" -ArgumentList "-m pip install chardet" -Wait
|
|
|
|
|
|
|
|
Write-Output "Installing py2exe"
|
|
|
|
Start-Process "$install_dir\python.exe" -ArgumentList "-m pip install py2exe" -Wait
|