mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-07 20:31:01 -05:00
Merge pull request #1655 from draeath/master
"system" python - support cases where python3, python2 is in PATH but not python
This commit is contained in:
commit
89d3d0c33d
2 changed files with 7 additions and 2 deletions
|
@ -30,7 +30,9 @@ OLDIFS="$IFS"
|
|||
{ IFS=:
|
||||
for version in ${PYENV_VERSION}; do
|
||||
if [ "$version" = "system" ]; then
|
||||
if PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python 2>/dev/null)"; then
|
||||
if PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python 2>/dev/null)" || \
|
||||
PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python3 2>/dev/null)" || \
|
||||
PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python2 2>/dev/null)"; then
|
||||
PYENV_PREFIX_PATH="${PYTHON_PATH%/bin/*}"
|
||||
PYENV_PREFIX_PATH="${PYENV_PREFIX_PATH:-/}"
|
||||
else
|
||||
|
|
|
@ -115,7 +115,10 @@ print_version() {
|
|||
}
|
||||
|
||||
# Include "system" in the non-bare output, if it exists
|
||||
if [ -n "$include_system" ] && PYENV_VERSION=system pyenv-which python >/dev/null 2>&1; then
|
||||
if [ -n "$include_system" ] && \
|
||||
(PYENV_VERSION=system pyenv-which python >/dev/null 2>&1 || \
|
||||
PYENV_VERSION=system pyenv-which python3 >/dev/null 2>&1 || \
|
||||
PYENV_VERSION=system pyenv-which python2 >/dev/null 2>&1) ; then
|
||||
print_version system
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue