Correctly populate the system python path

This commit is contained in:
frostming
2020-06-04 09:52:39 +08:00
parent 76e55dfef3
commit cce026efbf
3 changed files with 7 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
Fix a bug that incorrect Python path will be used when ``--system`` flag is on.
+2
View File
@@ -1946,6 +1946,8 @@ def do_install(
# Automatically use an activated virtualenv.
if PIPENV_USE_SYSTEM:
system = True
if system:
os.environ["PIPENV_USE_SYSTEM"] = "1"
# Check if the file is remote or not
if remote:
click.echo(
+4 -1
View File
@@ -267,7 +267,10 @@ class Environment(object):
def python(self):
# type: () -> str
"""Path to the environment python"""
py = vistir.compat.Path(self.script_basedir).joinpath("python").absolute().as_posix()
if os.name == "nt" and not self.is_venv:
py = vistir.compat.Path(self.prefix).joinpath("python").absolute().as_posix()
else:
py = vistir.compat.Path(self.script_basedir).joinpath("python").absolute().as_posix()
if not py:
return vistir.compat.Path(sys.executable).as_posix()
return py