aboutsummaryrefslogtreecommitdiff
path: root/files/.zsh/rc/S50_functions
diff options
context:
space:
mode:
Diffstat (limited to 'files/.zsh/rc/S50_functions')
-rw-r--r--files/.zsh/rc/S50_functions9
1 files changed, 7 insertions, 2 deletions
diff --git a/files/.zsh/rc/S50_functions b/files/.zsh/rc/S50_functions
index f510bd3..b9f2a08 100644
--- a/files/.zsh/rc/S50_functions
+++ b/files/.zsh/rc/S50_functions
@@ -64,7 +64,8 @@ alias calc="noglob calc"
# Take from @garybernhardt
activate_virtualenv() {
local found_location=""
- for name in venv env ; do
+ local default_name=venv
+ for name in $default_name env ; do
for up in . ../.. ../../.. ; do
if [ -f "$up/$name/bin/activate" ] ; then
found_location="$up/$name/bin/activate"
@@ -78,7 +79,11 @@ activate_virtualenv() {
# create
read -r "answer?Virtualenv not found, create? "
if [[ "$answer" =~ ^[Yy]$ ]] ; then
- virtualenv venv
+ if command -v virtualenv>/dev/null ; then
+ virtualenv $default_name
+ else
+ python3 -m venv $default_name
+ fi
activate_virtualenv
fi
else