Skip to content

Commit 0bcf1d9

Browse files
authored
Merge pull request #5773 from pypa/issue-5772
Pass system flag to python which
2 parents e6be3dd + 2d10376 commit 0bcf1d9

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

pipenv/project.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,12 +1155,11 @@ def which(self, search, as_path=True):
11551155
result = str(result.path)
11561156
return result
11571157

1158-
@property
1159-
def python(self) -> str:
1158+
def python(self, system=False) -> str:
11601159
"""Path to the project python"""
11611160
from pipenv.utils.shell import project_python
11621161

1163-
return project_python(self)
1162+
return project_python(self, system=system)
11641163

11651164
def _which(self, command, location=None, allow_global=False):
11661165
if not allow_global and location is None:

pipenv/utils/project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,4 @@ def ensure_project(
7979
skip_requirements=skip_requirements,
8080
system=system,
8181
)
82-
os.environ["PIP_PYTHON_PATH"] = project.python
82+
os.environ["PIP_PYTHON_PATH"] = project.python(system=system)

pipenv/utils/resolver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ def resolve_deps(
11661166
req_dir = req_dir if req_dir else os.environ.get("req_dir", None)
11671167
if not req_dir:
11681168
req_dir = create_tracked_tempdir(prefix="pipenv-", suffix="-requirements")
1169-
with HackedPythonVersion(python_path=project.python):
1169+
with HackedPythonVersion(python_path=project.python(system=allow_global)):
11701170
try:
11711171
results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
11721172
deps,
@@ -1185,7 +1185,7 @@ def resolve_deps(
11851185
# Second (last-resort) attempt:
11861186
if results is None:
11871187
with HackedPythonVersion(
1188-
python_path=project.python,
1188+
python_path=project.python(system=allow_global),
11891189
):
11901190
try:
11911191
# Attempt to resolve again, with different Python version information,

0 commit comments

Comments
 (0)