File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -101,15 +101,16 @@ function FindLatestPythonExecutableInRegistry {
101101 $PythonCoreRegistryLocation = " ${RootRegistryLocation} :\Software\Python\PythonCore"
102102 if (Test-Path $PythonCoreRegistryLocation ) {
103103 LogOutput " Python found in registry: $PythonCoreRegistryLocation "
104-
105104 $PythonInstallations = (Get-ChildItem - recurse $PythonCoreRegistryLocation ) | Sort-Object - Descending
106- ForEach ($Installation in $PythonInstallations ) {
107- # we are sorting by descending so this will grab the greatest installed version of python
108- If ($installation.Name.EndsWith (" \InstallPath" )) {
109- $PythonInstallLocation = (Get-ItemProperty - LiteralPath $Installation.PSPath ).' (default)'
110- return Join-Path $PythonInstallLocation " python.exe"
111- }
112- }
105+ if ($PythonInstallations ) {
106+ ForEach ($Installation in $PythonInstallations ) {
107+ # we are sorting by descending so this will grab the greatest installed version of python
108+ If ($installation.Name.EndsWith (" \InstallPath" )) {
109+ $PythonInstallLocation = (Get-ItemProperty - LiteralPath $Installation.PSPath ).' (default)'
110+ return Join-Path $PythonInstallLocation " python.exe"
111+ }
112+ }
113+ }
113114 }
114115
115116 return $PythonExecutable
You can’t perform that action at this time.
0 commit comments