-
-
Save styk-tv/b160cd2e4a54472ba04a17f11b7faca5 to your computer and use it in GitHub Desktop.
ubu22 pyenv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt-get install git python3-pip make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev curl liblzma-dev | |
sudo pip install virtualenvwrapper | |
git clone https://github.com/yyuu/pyenv.git ~/.pyenv | |
git clone https://github.com/yyuu/pyenv-virtualenvwrapper.git ~/.pyenv/plugins/pyenv-virtualenvwrapper | |
git clone https://github.com/pyenv/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv | |
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc | |
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc | |
echo 'eval "$(pyenv init -)"' >> ~/.bashrc | |
echo 'pyenv virtualenvwrapper' >> ~/.bashrc | |
exec $SHELL | |
### VENV ON PROMPT ADD TO .BASHRC | |
export PYENV_VIRTUALENV_DISABLE_PROMPT=1 | |
pyenvVirtualenvUpdatePrompt() { | |
RED='\[\e[0;31m\]' | |
GREEN='\[\e[0;32m\]' | |
BLUE='\[\e[0;34m\]' | |
RESET='\[\e[0m\]' | |
[ -z "$PYENV_VIRTUALENV_ORIGINAL_PS1" ] && export PYENV_VIRTUALENV_ORIGINAL_PS1="$PS1" | |
[ -z "$PYENV_VIRTUALENV_GLOBAL_NAME" ] && export PYENV_VIRTUALENV_GLOBAL_NAME="$(pyenv global)" | |
VENV_NAME="$(pyenv version-name)" | |
VENV_NAME="${VENV_NAME##*/}" | |
GLOBAL_NAME="$PYENV_VIRTUALENV_GLOBAL_NAME" | |
# non-global versions: | |
COLOR="$BLUE" | |
# global version: | |
[ "$VENV_NAME" == "$GLOBAL_NAME" ] && COLOR="$RED" | |
# virtual envs: | |
[ "${VIRTUAL_ENV##*/}" == "$VENV_NAME" ] && COLOR="$GREEN" | |
if [ -z "$COLOR" ]; then | |
PS1="$PYENV_VIRTUALENV_ORIGINAL_PS1" | |
else | |
PS1="($COLOR${VENV_NAME}$RESET)$PYENV_VIRTUALENV_ORIGINAL_PS1" | |
fi | |
export PS1 | |
} | |
export PROMPT_COMMAND="$PROMPT_COMMAND pyenvVirtualenvUpdatePrompt;" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for ubuntu 22 its python3-pip