@@ -70,7 +70,7 @@ def _minimum_pip_version() -> str:
7070 return '19.1.0'
7171
7272
73- def _has_valid_pip (** distargs : object ) -> bool :
73+ def _has_valid_pip (__version : str | None = None , ** distargs : object ) -> bool :
7474 """
7575 Given a path, see if Pip is present and return True if the version is
7676 sufficient for build, False if it is not. ModuleNotFoundError is thrown if
@@ -90,7 +90,7 @@ def _has_valid_pip(**distargs: object) -> bool:
9090
9191 current_pip_version = packaging .version .Version (pip_distribution .version )
9292
93- return current_pip_version >= packaging .version .Version (_minimum_pip_version ())
93+ return current_pip_version >= packaging .version .Version (__version or _minimum_pip_version ())
9494
9595
9696@functools .lru_cache (maxsize = None )
@@ -101,7 +101,8 @@ def _valid_global_pip() -> bool | None:
101101 """
102102
103103 try :
104- return _has_valid_pip ()
104+ # Version to have added the `--python` option.
105+ return _has_valid_pip ('22.3' )
105106 except ModuleNotFoundError :
106107 return None
107108
@@ -157,7 +158,7 @@ def python_executable(self) -> str:
157158
158159 def _pip_args (self ) -> list [str ]:
159160 if _valid_global_pip ():
160- return [sys .executable , '-Im ' , 'pip' , '--python' , self .python_executable ]
161+ return [sys .executable , '-m ' , 'pip' , '--python' , self .python_executable ]
161162 else :
162163 return [self .python_executable , '-Im' , 'pip' ]
163164
0 commit comments