5

Install Pyenv & Pipenv on AWS EC2 (Amazon Linux)

 1 year ago
source link: https://gist.github.com/norsec0de/b863e2d99e251b848b5e9fece1c45f1a
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Install Pyenv & Pipenv on AWS EC2 (Amazon Linux)

Installation

Install Dependencies

Pyenv builds Python versions from source and therefore requires all the necessary build dependencies.

sudo yum install gcc zlib-devel bzip2 bzip2-devel patch readline-devel sqlite sqlite-devel openssl-devel tk-devel libffi-devel

Install Git

You'll need git installed to be able to clone the repositories

sudo yum install git

Clone the Pyenv Git Repository

git clone https://github.com/pyenv/pyenv.git ~/.pyenv

Configure your '.bash_profile' file

echo ' ' >> ~/.bash_profile
echo '# Pyenv Configuration' >> ~/.bash_profile
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile

Reinitialise your Shell

source ~/.bash_profile

Testing pyenv

pyenv

Configuration

To prevent any existing system dependencies from breaking, it's a good idea to setup pyenv with versions of the current existing python installations.

Make a note of the version numbers currently installed for python2 and python3.

$ python -V
Python 2.7.5

$ python3 -V
Python 3.6.8

Install matching systrem python versions

pyenv install 2.7.5
pyenv install 3.6.8

Configure Global python versions

pyenv global 3.6.8 2.7.5

Check that the versions are associated correctly

$ pyenv versions
  system
* 2.7.5 (set by /home/norsey/.pyenv/version)
* 3.6.8 (set by /home/norsey/.pyenv/version)

Upgrade Pip

pip install --upgrade pip

Install Pipenv

pip install --user pipenv

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK