@@ -156,10 +156,10 @@ function TPythonVersion.GetDisplayName: string;
156156 FormatStr := ' Conda %s (%s)'
157157 else
158158 FormatStr := ' Python %s (%s)' ;
159- if Is_venv then
160- FormatStr := FormatStr + ' -venv '
161- else if Is_virtualenv then
162- FormatStr := FormatStr + ' -virtualenv ' ;
159+ if Is_virtualenv then
160+ FormatStr := FormatStr + ' -virtualenv '
161+ else if Is_venv then
162+ FormatStr := FormatStr + ' -venv ' ;
163163
164164 FDisplayName := Format(FormatStr, [SysVersion, SysArchitecture]);
165165 end ;
@@ -197,7 +197,7 @@ function TPythonVersion.GetPythonExecutable: string;
197197begin
198198 Result := IncludeTrailingPathDelimiter(InstallPath) + ' python.exe' ;
199199 if not FileExists(Result) then begin
200- Result := IncludeTrailingPathDelimiter(InstallPath) + ' Scripts\ python.exe' ;
200+ Result := IncludeTrailingPathDelimiter(InstallPath) + ' Scripts' + PathDelim + ' python.exe' ;
201201 if not FileExists(Result) then Result := ' ' ;
202202 end ;
203203end ;
@@ -226,8 +226,7 @@ function TPythonVersion.Is_venv: Boolean;
226226
227227function TPythonVersion.Is_virtualenv : Boolean;
228228begin
229- Result := not IsRegistered and (InstallPath <> DLLPath) and
230- not FileExists(IncludeTrailingPathDelimiter(InstallPath) + ' pyvenv.cfg' );
229+ Result := Is_venv and FileExists(IncludeTrailingPathDelimiter(InstallPath) + ' Scripts' + PathDelim + DLLName);
231230end ;
232231
233232function CompareVersions (A, B : string) : Integer;
@@ -485,10 +484,6 @@ function PythonVersionFromPath(const Path: string; out PythonVersion: TPythonVer
485484
486485 DLLFileName := FindPythonDLL(DLLPath);
487486
488- if (DLLFileName = ' ' ) and AcceptVirtualEnvs then begin
489- DLLPath := DLLPath + ' \Scripts' ;
490- DLLFileName := FindPythonDLL(DLLPath);
491- end ;
492487 if DLLFileName = ' ' then begin
493488 if AcceptVirtualEnvs and PythonVersion.Is_venv then
494489 begin
0 commit comments