Install Python using pyenv - caprivm/virtualization GitHub Wiki

caprivm ([email protected])

Description

This page shows how to install Python using pyenv on a virtual machine. The installation tests were performed on a server with the following features:

Feature Value
OS Used Ubuntu 18.04 LTS
vCPU 4
RAM (GB) 8
Disk (GB) 60
Home user ubuntu

The contents of the page are:

Install Python usging pyenv

Run the following commands to download the pyenv repository and install Python. In this case, python 3.7.3 is installed:

# Use pyenv for the installation.
cd && sudo apt update && sudo apt upgrade -y
sudo apt install -y git fakeroot
cd && git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile
echo 'eval "$(pyenv init --path)"' >> ~/.profile
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init --path)"\nfi' >> ~/.bashrc
source ~/.bashrc && source ~/.profile
exec "$SHELL"
sudo apt-get update
sudo apt-get install -y --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
# Confirm the available versions of Python 3.6.x - 3.8.x. 
pyenv install --list | grep " 3\.[678]"
# Install python 3.7.3
pyenv install 3.7.3
pyenv global 3.7.3

If you want to validate the installation, run:

python -V
# Python 3.7.3

Install basic Python Packages using pip3

After installing Python 3.7.3, install the packages necessary for the operation of Magma:

cd && pip3 install ansible fabric3 jsonpickle requests PyYAML
⚠️ **GitHub.com Fallback** ⚠️