From 65ccd765b6d0b78e602d4b233ca8e31e1a6b8adb Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Fri, 21 Sep 2018 11:11:46 +1000 Subject: [PATCH] Create virtualenvs directory if it does not exist --- pipenv/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pipenv/utils.py b/pipenv/utils.py index b7295c29..0e1f851d 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -1281,7 +1281,10 @@ def get_workon_home(): workon_home = os.path.join( os.environ.get("XDG_DATA_HOME", "~/.local/share"), "virtualenvs" ) - return Path(os.path.expandvars(workon_home)).expanduser() + # Create directory if it does not already exist + expanded_path = Path(os.path.expandvars(workon_home)).expanduser() + mkdir_p(str(expanded_path)) + return expanded_path def is_virtual_environment(path):