Skip to content

Latest commit

 

History

History
112 lines (86 loc) · 1.86 KB

install.md

File metadata and controls

112 lines (86 loc) · 1.86 KB

Install

  1. Install required packages
  2. Set RC
  3. Install Pyenv
  4. Install Autoenv
  5. Install Latest Python
  6. Set Global Python Version
  7. Set Vim's Python

Prerequisites

macOS

xcode-select --install
brew install openssl readline sqlite3 xz zlib tcl-tk

Linux

Ubuntu

build_tools="
build-essential
libssl-dev
zlib1g-dev
libbz2-dev
libreadline-dev
libsqlite3-dev
curl
libncursesw5-dev
xz-utils
tk-dev
libxml2-dev
libxmlsec1-dev
libffi-dev
liblzma-dev
"

sudo apt update
sudo apt install $build_tools

Set profile.rc

Add to .bashrc or .zshrc:

# pyenv
if [ -d "$HOME/.pyenv" ]; then
    export PYENV_ROOT="$HOME/.pyenv"
    command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
    eval "$(pyenv init -)"
    eval "$(pyenv virtualenv-init -)"
fi

# autoenv
if [ -d "$HOME/.autoenv" ]; then
    export AUTOENV_ENV_FILENAME='.autoenv'
    export AUTOENV_ENV_LEAVE_FILENAME='.autoenv.leave'
    export AUTOENV_ENABLE_LEAVE='enabled'
    source "$HOME/.autoenv/activate.sh"
fi

Pyenv

curl https://pyenv.run | bash

Autoenv

git clone https://github.com/hyperupcall/autoenv $HOME/.autoenv

Install Latest Python

version=3.11
latest_version=$(pyenv latest -k $version)
pyenv install -v --skip-existing $latest_version

Update Global Python Version

global_version=$(pyenv global)
if [ $global_version != $latest_version ]; then
    pyenv global $latest_version
fi
pip install --upgrade pip setuptools wheel

for Vim

pyenv virtualenv $latest_version vim
$HOME/.pyenv/versions/vim/bin/pip install --upgrade pip setuptools wheel pynvim