From 789c349570491afc49842ae75033309c04ae4e33 Mon Sep 17 00:00:00 2001 From: "Yamashita, Yuu" Date: Fri, 27 Nov 2015 04:41:00 +0000 Subject: [PATCH] Allow specifying python version for conda via `-p` or `--python` --- bin/pyenv-virtualenv | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/pyenv-virtualenv b/bin/pyenv-virtualenv index 1033e9e..df65e04 100755 --- a/bin/pyenv-virtualenv +++ b/bin/pyenv-virtualenv @@ -365,7 +365,14 @@ if [ -n "$UPGRADE" ]; then fi if [ -n "${USE_CONDA}" ]; then - : + # e.g. `conda create -n py35 python=3.5 anaconda` + if [ -n "${VIRTUALENV_PYTHON}" ]; then + VIRTUALENV_PYTHON="${VIRTUALENV_PYTHON##*/}" + VIRTUALENV_PYTHON="${VIRTUALENV_PYTHON#python}" + if [ -n "${VIRTUALENV_PYTHON}" ]; then + VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]="python=${VIRTUALENV_PYTHON}" + fi + fi else if [ -n "${USE_PYVENV}" ]; then # Unset some arguments not supported by pyvenv