Skip to content

Commit 2649b66

Browse files
committed
python-setup: Fix site-packages selection without pip for Windows
1 parent b810730 commit 2649b66

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

python-setup/find_site_packages.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
# poetry/requests-3, I was not allowed to install pip! So I did not pursue this
2020
# option further.
2121
#
22-
# Instead, local testing shows that first entry of `site.getsitepackages()` has the
23-
# right path, whereas `site.getusersitepackages()` is about the system python (very
22+
# Instead, testing (on both Windows and Linux) shows that the last entry of
23+
# `site.getsitepackages()` has the right path (note: On linux there is only a single
24+
# entry), whereas `site.getusersitepackages()` is about the system python (very
2425
# confusing).
2526
#
2627
# We can't use the environment variable POETRY_VIRTUALENVS_OPTIONS_NO_PIP because it
2728
# does not work, see https://github.com/python-poetry/poetry/issues/5906
2829
import site
29-
print(site.getsitepackages()[0])
30+
print(site.getsitepackages()[-1])

0 commit comments

Comments
 (0)