You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.2 KiB
32 lines
1.2 KiB
3 weeks ago
|
$url = "https://www.python.org/ftp/python/3.11.5/python-3.11.5-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 py2exe"
|
||
|
Start-Process "$install_dir\python.exe" -ArgumentList "-m pip install py2exe" -Wait
|