@@ -50,18 +50,22 @@ def _get_platform_information():
50
50
import sysconfig
51
51
system_information = {"platform" : sysconfig .get_platform ()}
52
52
system_information .update ({"python version" : sys .version_info })
53
+ binary_path = str (Path (sys .exec_prefix ).joinpath (sys .exec_prefix ).joinpath ("bin" ))
54
+ hidden_console_binary = str (Path (sys .executable ))
55
+ main_binary = str (Path (sys .executable ))
53
56
if sys .platform == "win32" :
54
- system_information .update ({"binary path" : sys .exec_prefix })
55
- system_information .update (
56
- {"main binary" : str (Path (sys .exec_prefix ).joinpath ("python.exe" ))})
57
- system_information .update (
58
- {"hidden console binary" : str (Path (sys .exec_prefix ).joinpath ("pythonw.exe" ))})
59
- else :
60
- system_information .update ({"binary path" : str (Path (sys .exec_prefix ).joinpath (sys .exec_prefix ).joinpath ("bin" ))})
61
- system_information .update (
62
- {"main binary" : sys .executable })
63
- system_information .update (
64
- {"hidden console binary" : sys .executable })
57
+ if sys .prefix == sys .base_prefix :
58
+ main_binary = str (Path (sys .exec_prefix ).joinpath ("python.exe" ))
59
+ hidden_console_binary = str (Path (sys .exec_prefix ).joinpath ("pythonw.exe" ))
60
+ else :
61
+ # Virtual environment detected
62
+ # TODO: MacOS and Linux?
63
+ main_binary = str (Path (sys .prefix ) / "Scripts" / "python.exe" )
64
+ hidden_console_binary = str (Path (sys .prefix ) / "Scripts" / "pythonw.exe" )
65
+ system_information .update ({"binary path" : binary_path })
66
+ system_information .update ({"main binary" : main_binary })
67
+ system_information .update ({"hidden console binary" : hidden_console_binary })
68
+
65
69
return system_information
66
70
67
71
0 commit comments