1# 1. install pyenv: https://github.com/pyenv/pyenv-installer
2 # install Prerequisites: https://github.com/pyenv/pyenv/wiki/Common-build-problems
3 sudo apt install libedit-dev libncurses5-dev
4 # install pyenv
5 curl https://pyenv.run | bash
6 # configure for bash/Zsh
7 echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile
8 echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile
9 echo 'eval "$(pyenv init --path)"' >> ~/.profile
10 # for Bash:
11 echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
12 # for Zsh
13 echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc
14 # restart the shell for changes to take effect
15 # before you can install python, you need to install python dependancies:
16 # https://github.com/pyenv/pyenv/wiki#suggested-build-environment
17 sudo apt-get update; sudo apt-get install make build-essential libssl-dev zlib1g-dev \
18libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
19libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
20 # install some python versions
21 pyenv install 3.8.10
22 # set the default python version
23 pyenv global 3.8.10
24
25# 2. install pipx
26python -m pip install pipx
27# logout then login to make installation take effect
28# 3. install poetry
29pipx install poetry
30
31# 4. for deployment
32https://jacobian.org/2019/nov/11/python-environment-2020/
33