Fix a bug of deleting a virtualenv that is not managed by Pipenv

Close #4867
This commit is contained in:
Frost Ming
2021-11-17 00:06:13 +08:00
parent b0ceaed5bc
commit eafcfb2c1e
2 changed files with 3 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
Fix a bug of deleting a virtualenv that is not managed by Pipenv.
+2 -1
View File
@@ -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 "