Skip to content

Commit 6035005

Browse files
committed
Support environments without pip
1 parent f7496a5 commit 6035005

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

flit/install.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,16 @@ def install_requirements(self):
249249
for req_d in requirements
250250
]
251251

252+
# Use either pip in the venv or in the current environment,
253+
# whichever is available.
254+
try:
255+
import pip # noqa: F401
256+
except ImportError:
257+
cmd = [self.python, '-m', 'pip', 'install']
258+
else:
259+
cmd = [sys.executable, '-m', 'pip', 'install', '--python', self.python]
260+
252261
# install the requirements with pip
253-
cmd = [self.python, '-m', 'pip', 'install']
254262
if self.user:
255263
cmd.append('--user')
256264
with tempfile.NamedTemporaryFile(mode='w',

0 commit comments

Comments
 (0)