@@ -132,13 +132,11 @@ def _sys_executable_matches(version: str) -> bool:
132132 return sys .version_info [:len (info )] == info
133133
134134
135- def norm_version (version : str ) -> str :
136- if version == C .DEFAULT :
137- return os .path .realpath (sys .executable )
138-
139- # first see if our current executable is appropriate
140- if _sys_executable_matches (version ):
141- return sys .executable
135+ def norm_version (version : str ) -> Optional [str ]:
136+ if version == C .DEFAULT : # use virtualenv's default
137+ return None
138+ elif _sys_executable_matches (version ): # virtualenv defaults to our exe
139+ return None
142140
143141 if os .name == 'nt' : # pragma: no cover (windows)
144142 version_exec = _find_by_py_launcher (version )
@@ -194,8 +192,10 @@ def install_environment(
194192 additional_dependencies : Sequence [str ],
195193) -> None :
196194 envdir = prefix .path (helpers .environment_dir (ENVIRONMENT_DIR , version ))
195+ venv_cmd = [sys .executable , '-mvirtualenv' , envdir ]
197196 python = norm_version (version )
198- venv_cmd = (sys .executable , '-mvirtualenv' , envdir , '-p' , python )
197+ if python is not None :
198+ venv_cmd .extend (('-p' , python ))
199199 install_cmd = ('python' , '-mpip' , 'install' , '.' , * additional_dependencies )
200200
201201 with clean_path_on_failure (envdir ):
0 commit comments