Skip to content

Commit

Permalink
env: prefer "python -m pip" to calling pip directly to allow pip upda…
Browse files Browse the repository at this point in the history
…ting itself on Windows
  • Loading branch information
radoering committed Sep 6, 2022
1 parent 3bdc397 commit b9ed1f0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/poetry/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,10 @@ def get_marker_env(self) -> dict[str, Any]:
raise NotImplementedError()

def get_pip_command(self, embedded: bool = False) -> list[str]:
return [self.python, self.pip_embedded if embedded else self.pip]
if embedded or not Path(self._bin(self._pip_executable)).exists():
return [self.python, self.pip_embedded]
# run as module so that pip can update itself on Windows
return [self.python, "-m", "pip"]

def get_supported_tags(self) -> list[Tag]:
raise NotImplementedError()
Expand Down

0 comments on commit b9ed1f0

Please sign in to comment.