#!/usr/bin/env bash
set -e
[ -n "$PYENV_DEBUG" ] && set -x
if [ -z "$PYENV_ROOT" ]; then
export PYENV_ROOT="${HOME}/.pyenv"
fi
colorize() {
if [ -t 1 ]; then printf "\e[%sm%s\e[m" "$1" "$2"
else echo -n "$2"
fi
}
# Checks for `.pyenv` file, and suggests to remove it for installing
if [ -d "${PYENV_ROOT}" ]; then
{ echo
colorize 1 "WARNING"
echo ": Can not proceed with installation. Kindly remove the '${PYENV_ROOT}' directory first."
echo
} >&2
exit 1
fi
failed_checkout() {
echo "Failed to git clone $1"
exit -1
}
checkout() {
[ -d "$2" ] || git -c advice.detachedHead=0 clone --branch "$3" --depth 1 "$1" "$2" || failed_checkout "$1"
}
if ! command -v git 1>/dev/null 2>&1; then
echo "pyenv: Git is not installed, can't continue." >&2
exit 1
fi
if [ -n "${USE_GIT_URI}" ]; then
GITHUB="git://github.com"
else
GITHUB="https://gitee.com"
fi
checkout "${GITHUB}/wtgg/pyenv.git" "${PYENV_ROOT}" "${PYENV_GIT_TAG:-master}"
checkout "${GITHUB}/wtgg/pyenv-doctor.git" "${PYENV_ROOT}/plugins/pyenv-doctor" "master"
checkout "${GITHUB}/wtgg/pyenv-installer.git" "${PYENV_ROOT}/plugins/pyenv-installer" "master"
checkout "${GITHUB}/wtgg/pyenv-update.git" "${PYENV_ROOT}/plugins/pyenv-update" "master"
checkout "${GITHUB}/wtgg/pyenv-virtualenv.git" "${PYENV_ROOT}/plugins/pyenv-virtualenv" "master"
checkout "${GITHUB}/wtgg/pyenv-which-ext.git" "${PYENV_ROOT}/plugins/pyenv-which-ext" "master"
if ! command -v pyenv 1>/dev/null; then
{ echo
colorize 1 "WARNING"
echo ": seems you still have not added 'pyenv' to the load path."
echo
} >&2
{ # Without args, `init` commands print installation help
"${PYENV_ROOT}/bin/pyenv" init || true
"${PYENV_ROOT}/bin/pyenv" virtualenv-init || true
} >&2
fi
wtgg_pyenv-installer.sh
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
相關(guān)閱讀更多精彩內(nèi)容
- https://github.com/pyenv/pyenv-virtualenvpyenv-virtualenv...
- 1、Pyenv簡介 pyenv可以解決多個python環(huán)境共存的問題,是一個便捷的python版本管理工具。 2、...
- 關(guān)于pyenv 安裝很慢的解決辦法:可以先手動下載對應(yīng)的版本壓縮包,放到~/.pyenv/cache/下面,pye...
- pyenv Install pyenv Config press "i" into insert mode, th...
- 問題:1、Python解釋器版本混亂, 2和3差別巨大, 而且細(xì)分版本也不盡相同, 難以選擇和管理.2、不同Lin...