From 6035005746ac1ee2f7952a9fd89431705ab0a5da Mon Sep 17 00:00:00 2001 From: gram Date: Tue, 11 Jul 2023 08:46:14 +0200 Subject: [PATCH] Support environments without pip --- flit/install.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/flit/install.py b/flit/install.py index 3ea9a4bf..35d76b9c 100644 --- a/flit/install.py +++ b/flit/install.py @@ -249,8 +249,16 @@ def install_requirements(self): for req_d in requirements ] + # Use either pip in the venv or in the current environment, + # whichever is available. + try: + import pip # noqa: F401 + except ImportError: + cmd = [self.python, '-m', 'pip', 'install'] + else: + cmd = [sys.executable, '-m', 'pip', 'install', '--python', self.python] + # install the requirements with pip - cmd = [self.python, '-m', 'pip', 'install'] if self.user: cmd.append('--user') with tempfile.NamedTemporaryFile(mode='w',