Fixed bug that caused PATH not to be refreshed after python installation

This commit is contained in:
VakarisZ 2019-10-03 17:20:14 +03:00
parent fabcd4c9df
commit 04d8f1341b
1 changed files with 2 additions and 3 deletions

View File

@ -56,13 +56,12 @@ function Deploy-Windows([String] $monkey_home = (Get-Item -Path ".\").FullName,
"Select 'add to PATH' when installing"
$webClient.DownloadFile($PYTHON_URL, $TEMP_PYTHON_INSTALLER)
Start-Process -Wait $TEMP_PYTHON_INSTALLER -ErrorAction Stop
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine")
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
Remove-Item $TEMP_PYTHON_INSTALLER
# Check if installed correctly
$version = cmd.exe /c '"python" --version 2>&1'
if ( $version -like '* is not recognized*' ) {
"Python is not found in PATH. If you just installed python you need to restart cmd.
Else, add it manually or reinstall python."
"Python is not found in PATH. Add it to PATH and relaunch the script."
return
}
}