Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect environment when inside venv #4284

Merged
merged 2 commits into from May 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions news/4276.bugfix.rst
@@ -0,0 +1 @@
Fix a bug that system-wide packages will be considered when inside a venv.
4 changes: 2 additions & 2 deletions pipenv/project.py
Expand Up @@ -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,
Expand Down