Install & Create

Install

Install python with pyenvarrow-up-right.

sudo apt update; sudo apt install make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl git \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
curl -fsSL https://pyenv.run | bash
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init - bash)"' >> ~/.bashrc
source ~/.bashrc

List available versions to install

pyenv install -l

Install a version

pyenv install <version>

Set global version

pyenv global <version>

Check global version

Creating a Project

Virtual Environement

You can create projects with a package.json alike way, with venvarrow-up-right.

When using Virtual Environments, dependencies installed via pip will be installed at a project scope, instead of globally.

Create the environment

Active the environment

Deactivate

Create requirements.txt

This file will act like a package.json, saving the dependencies.

To reinstall from a requirements.txt

Will have to recreate the environment first.

Last updated