diff --git a/news/4867.bugfix.rst b/news/4867.bugfix.rst new file mode 100644 index 00000000..4d949632 --- /dev/null +++ b/news/4867.bugfix.rst @@ -0,0 +1 @@ +Fix a bug of deleting a virtualenv that is not managed by Pipenv. diff --git a/pipenv/cli/command.py b/pipenv/cli/command.py index 24d8c0e6..a3910b22 100644 --- a/pipenv/cli/command.py +++ b/pipenv/cli/command.py @@ -1,6 +1,7 @@ import os import sys +from pipenv import environments from pipenv.__version__ import __version__ from pipenv._compat import fix_utf8 from pipenv.cli.options import ( @@ -124,7 +125,7 @@ def cli( # --rm was passed... elif rm: # Abort if --system (or running in a virtualenv). - if state.project.s.PIPENV_USE_SYSTEM: + if state.project.s.PIPENV_USE_SYSTEM or environments.is_in_virtualenv(): echo( crayons.red( "You are attempting to remove a virtualenv that "