WSL2 使用记录

last modify

安装 WSL2

WSL 的手动安装步骤 | Microsoft Learn

这里推荐分步安装;官方推荐的 首次安装 可能会在下载 Linux 发行版的时候卡住,而手动从应用商店下载的速度则非常快;

官方推荐设置

环境配置

zsh (可选)

Installing ZSH · ohmyzsh/ohmyzsh Wiki

Python

anaconda

选择需要安装的 anaconda 版本: https://repo.anaconda.com/archive

部分安装信息

安装 Pycharm 专业版

C++ 编译环境

Get Started with C++ and Windows Subsystem for Linux in Visual Studio Code

WSL 常用操作

路径

  • 在 WSL 中访问 Windows 路径:/mnt/<盘符字母>/<file_path>, 如 /mnt/d/tmp/test.txt

  • 在 Windows 中访问 WSL 路径:\\wsl$\<Linux名称>\<file_path>, 如 \\wsl$\Ubuntu-20.04\tmp\test.txt

    Linux 名称可以在 Win 文件管理器路径中访问 \\wsl$ 查看

  • 在 WSL 中用 VSCode 中打开文件/文件夹

  • 在 WSL 中用 Win 文件管理器打开文件夹

FAQ

fatal: unable to access 'https://github.com/xxx.git'

git clone 时用 https 的方式报错 - CSDN博客

Last updated