Created
August 5, 2022 03:05
-
-
Save wolfymaster/a884e5f184995d41285422cb4f080b22 to your computer and use it in GitHub Desktop.
Install pyenv
This file contains hidden or 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
# Install pyenv to manage python versions and create a virtualenv | |
#!/bin/bash | |
# clone pyenv repo | |
git clone https://github.com/pyenv/pyenv.git ~/.pyenv | |
# Add pyenv to .bashrc | |
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc | |
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc | |
# Ask for python version | |
read -p "python version: " pyversion | |
PYENV=$(which pyenv) | |
# Install the python version | |
bash -c "$PYENV install $pyversion" | |
# Create virtualenv with python version | |
virtualenv -p=$(pyenv which python) env | |
# Start virtualenv | |
source env/bin/activate | |
echo "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment