Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ikhsanalatsary/f5839e0027d27ddcf65d0ae8beee6f40 to your computer and use it in GitHub Desktop.
Save ikhsanalatsary/f5839e0027d27ddcf65d0ae8beee6f40 to your computer and use it in GitHub Desktop.
Add python to Windows Subsystem for Linux (WSL) [ubuntu]

Install Windows Subsystem for Linux (WSL) [ubuntu]

Follow this guide to install WSL:

https://docs.microsoft.com/en-us/windows/wsl/install-win10

Prepare WSL (ubuntu)

  1. Get your build tools and python required libraries installed:

    See: https://stackoverflow.com/questions/8097161/how-would-i-build-python-myself-from-source-code-on-ubuntu/31492697

    sudo apt update && sudo apt install -y build-essential git libexpat1-dev libssl-dev zlib1g-dev \
    libncurses5-dev libbz2-dev liblzma-dev \
    libsqlite3-dev libffi-dev tcl-dev linux-headers-generic libgdbm-dev \
    libreadline-dev tk tk-dev
    
  2. Install pyenv (which will install python):

    See: https://github.com/pyenv/pyenv-installer

    curl https://pyenv.run | bash
    
  3. After install, it tells you to add the following to your ~/.bashrc file, go do that:

    # Load pyenv automatically by adding
    # the following to ~/.bashrc:
    
    export PATH="/home/{USERNAME}/.pyenv/bin:$PATH"
    eval "$(pyenv init -)"
    eval "$(pyenv virtualenv-init -)"
    
    
  4. Install the latest 'common' versions of python through pyenv:

    # list available python versions
    # pyenv install --list
    pyenv install 3.6.8
    pyenv install 3.7.2
    
  5. Install/Upgrade base libraries into both versions of python:

    pyenv global 3.6.8
    pip install pip --upgrade
    pip install pipenv
    
    pyenv global 3.7.2
    pip install pip --upgrade
    pip install pipenv
    

-- Go to work!

Using WSL 2

  1. Open cmder
  2. On the menu, open Settings option and then select Startup > Tasks from the menu tree (or just hit Win + Alt + T)
  3. Click the “+” button to add a new task and fill in the fields as follow:
  4. Name: {zsh::home}
  5. Task Parameters:
    /icon "%CMDER_ROOT%\icons\cmder.ico"
    
    Commands:
    cmd /c C:\Windows\System32\wsl.exe ~ -new_console:p:%USERPROFILE%
    
  6. Click Save Settings

using WSL 2

  1. Download latest cygwin1-20200531.dll.xz from https://cygwin.com/snapshots/ and unpack the file as cygwin1.dll into ConEmu\wsl\ (replacing the original file there)
  2. Download @Biswa96's wslbridge2 from https://github.com/Biswa96/wslbridge2/releases and unpack to the same directory
  3. Open cmder
  4. On the menu, open Settings option and then select Startup > Tasks from the menu tree (or just hit Win + Alt + T)
  5. Click the “+” button to add a new task and fill in the fields as follow:
  6. Name: {zsh::bridge}
  7. Task Parameters:
    /icon "%CMDER_ROOT%\icons\cmder.ico"
    
    Commands:
    set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe %ConEmuBaseDirShort%\wsl\wslbridge2.exe -cur_console:pm:/mnt -eConEmuBuild -eConEmuPID -eConEmuServerPID -l
    
  8. Click Save Settings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment