8000 Windows: WSL is Required · Issue #12 · kyclark/tiny_python_projects · GitHub
[go: up one dir, main page]

Skip to content

Windows: WSL is Required #12

@pjones

Description

@pjones

Although the introduction to the book says "If you use a Windows computer, you may want to install Windows Subsystem for Linux (WSL)." If fact, WSL is required. I don't think this is necessarily a problem but it should be clarified that the book assumes a POSIX environment and plain Windows isn't going to work.

I tried to get the book's code working in a Windows VM (to mimic the environment my adult son is using) and quickly ran into problems. As pointed out by others, the code uses POSIX directory separators, assumes Python is installed as python3 and uses shebangs and chmod.

Below are my notes for getting Windows configured so the code in this book works correctly. The notes are a bit brief and written from the point of view of a novice Windows user but experienced Linux user. If something doesn't make sense or there is a problem in these instructions please let me know.

Correctly Configuring Windows

  1. Install Visual Studio Code:

    https://code.visualstudio.com

  2. Install the Windows Subsystem for Linux (WSL) Version 2:

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

    NOTE: This is a rather complicated installation.

  3. Install the Ubuntu Linux Distribution (20.04 or Latest LTS)

    https://www.microsoft.com/store/apps/9n6svws3rx71

  4. Start Ubuntu and install dependencies:

    sudo apt update
    sudo apt upgrade
    sudo apt install python3-pip
  5. Get the book's source code, install more dependencies,
    and then start Visual Studio Code:

    mkdir src
    cd src
    git clone https://github.com/kyclark/tiny_python_projects.git
    cd tiny_python_projects
    pip3 install -r requirements.txt
    code .
  6. Configure Visual Studio Code to use login shells:

    In order to use tools like pytest (which are installed in
    ~/.local/bin) you'll need to configure Visual Studio Code to
    start a login shell when opening terminals:

    • In Visual Studio: File -> Preferences -> Settings
    • Location: Features -> Terminal
    • Scroll down to: Terminal -> Integrated -> Shell Args: Linux
    • Add the following item: -l

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0