File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 19
19
# poetry/requests-3, I was not allowed to install pip! So I did not pursue this
20
20
# option further.
21
21
#
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
25
- # confusing).
22
+ # Instead, testing `site.getsitepackages()` contains has the right path, whereas
23
+ # `site.getusersitepackages()` is about the system python (very confusing).
26
24
#
27
25
# We can't use the environment variable POETRY_VIRTUALENVS_OPTIONS_NO_PIP because it
28
26
# does not work, see https://github.com/python-poetry/poetry/issues/5906
29
27
import site
30
- print (site .getsitepackages ()[- 1 ])
28
+
29
+ if sys .platform .startswith ("win32" ):
30
+ # On windows, the last entry of `site.getsitepackages()` has the right path
31
+ print (site .getsitepackages ()[- 1 ])
32
+ else :
33
+ # on unix, the first entry of `site.getsitepackages()` has the right path
34
+ print (site .getsitepackages ()[0 ])
You can’t perform that action at this time.
0 commit comments