DEV Community

Cover image for How to install Homebrew, Pyenv, Pipenv in WSL (Windows) Ubuntu 20.04
Gokul
Gokul

Posted on

How to install Homebrew, Pyenv, Pipenv in WSL (Windows) Ubuntu 20.04

Why homebrew? :

Homebrew Installation :

  • Follow the steps mentioned in the below script
$/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Enter fullscreen mode Exit fullscreen mode

output and follow next steps :

image

install homebrew dependencies for Ubuntu (If needed) :

$sudo apt-get install build-essential procps curl file git
Enter fullscreen mode Exit fullscreen mode

Test installation by running below command:

$brew install hello
Enter fullscreen mode Exit fullscreen mode

Pyenv installation

Why pyenv ? :

  • pyenv lets you to switch between python versions in ubuntu.

Install python build dependencies for ubuntu :

$sudo apt-get update; sudo apt-get install make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

Enter fullscreen mode Exit fullscreen mode

then run

$curl https://pyenv.run | bash

Enter fullscreen mode Exit fullscreen mode

Below lines should be available in .bashrc

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
Enter fullscreen mode Exit fullscreen mode

Restart Shell (If needed) :

$exec $SHELL
Enter fullscreen mode Exit fullscreen mode

or

Run below in windows command prompt :


wsl --shutdown 
& login into ubuntu again

Enter fullscreen mode Exit fullscreen mode

PIPENV Installation

Why pipenv? :

  • pipenv is used to create virtual environment, similar to venv,virtualenv,conda,etc.

Install pipenv using homebrew :

$brew install pipenv

Enter fullscreen mode Exit fullscreen mode

output:
image


References :

  1. https://brew.sh/
  2. https://docs.brew.sh/Homebrew-on-Linux
  3. https://github.com/pyenv/pyenv/wiki#suggested-build-environment
  4. https://github.com/pyenv/pyenv-installer
  5. https://pipenv.pypa.io/en/latest/
  6. Cover Photo by Hitesh Choudhary on Unsplash

Discussion (0)