forked from p15670423/monkey
Fixed bug that caused PATH not to be refreshed after python installation
This commit is contained in:
parent
e7a71e10d8
commit
97542107dc
|
@ -56,13 +56,12 @@ function Deploy-Windows([String] $monkey_home = (Get-Item -Path ".\").FullName,
|
||||||
"Select 'add to PATH' when installing"
|
"Select 'add to PATH' when installing"
|
||||||
$webClient.DownloadFile($PYTHON_URL, $TEMP_PYTHON_INSTALLER)
|
$webClient.DownloadFile($PYTHON_URL, $TEMP_PYTHON_INSTALLER)
|
||||||
Start-Process -Wait $TEMP_PYTHON_INSTALLER -ErrorAction Stop
|
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
|
Remove-Item $TEMP_PYTHON_INSTALLER
|
||||||
# Check if installed correctly
|
# Check if installed correctly
|
||||||
$version = cmd.exe /c '"python" --version 2>&1'
|
$version = cmd.exe /c '"python" --version 2>&1'
|
||||||
if ( $version -like '* is not recognized*' ) {
|
if ( $version -like '* is not recognized*' ) {
|
||||||
"Python is not found in PATH. If you just installed python you need to restart cmd.
|
"Python is not found in PATH. Add it to PATH and relaunch the script."
|
||||||
Else, add it manually or reinstall python."
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue