Skip to content

Instantly share code, notes, and snippets.

@hemna
Created April 10, 2019 17:53
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hemna/ae402ad26b641cd0564933a92d2339fd to your computer and use it in GitHub Desktop.
Save hemna/ae402ad26b641cd0564933a92d2339fd to your computer and use it in GitHub Desktop.
install pyenv and then install python 3.6.3 in that pyenv
# !/bin/bash
# Step 1. Install pyenv
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
source ~/.bashrc
# Step 2. Install missing headers for all the Python modules to be built
sudo zypper install readline-devel sqlite3-devel libbz2-devel zlib-devel libopenssl-devel libffi-devel
# Step 3. Install the desired Python version
pyenv install 3.6.3
# Step 4. Install virtualenv
sudo zypper install python3-virtualenv
# Step 5. Create a virtual environment for the installed Python and activate it
mkdir ~/pythons
cd ~/pythons
virtualenv -p ~/.pyenv/versions/3.6.3/bin/python3.6 python3.6.3
source ./python3.6.3/bin/activate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment