From af649b2b865db90e3c6eed91a6523a343ca3bf03 Mon Sep 17 00:00:00 2001 From: frostming Date: Fri, 29 May 2020 13:35:56 +0800 Subject: [PATCH 1/2] Fix incorrect environment when inside venv --- news/4276.bgufix.rst | 1 + pipenv/project.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 news/4276.bgufix.rst diff --git a/news/4276.bgufix.rst b/news/4276.bgufix.rst new file mode 100644 index 0000000000..960ab08b0e --- /dev/null +++ b/news/4276.bgufix.rst @@ -0,0 +1 @@ +Fix a bug that system-wide packages will be considered when inside a venv. diff --git a/pipenv/project.py b/pipenv/project.py index 40b6b26364..16bc715d67 100644 --- a/pipenv/project.py +++ b/pipenv/project.py @@ -330,11 +330,11 @@ def pipfile_package_names(self): def get_environment(self, allow_global=False): # type: (bool) -> Environment - if allow_global: + is_venv = is_in_virtualenv() + if allow_global and not is_venv: prefix = sys.prefix else: prefix = self.virtualenv_location - is_venv = is_in_virtualenv() sources = self.sources if self.sources else [DEFAULT_SOURCE] environment = Environment( prefix=prefix, is_venv=is_venv, sources=sources, pipfile=self.parsed_pipfile, From 08ec79d5db261b88c5b74caab17d765181fcd29f Mon Sep 17 00:00:00 2001 From: frostming Date: Fri, 29 May 2020 13:40:50 +0800 Subject: [PATCH 2/2] fix filename --- news/{4276.bgufix.rst => 4276.bugfix.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename news/{4276.bgufix.rst => 4276.bugfix.rst} (100%) diff --git a/news/4276.bgufix.rst b/news/4276.bugfix.rst similarity index 100% rename from news/4276.bgufix.rst rename to news/4276.bugfix.rst