准备
因开发需要Ubuntu 16.04 LTS + python 2.7环境
Store只有18和20未见16 (此方法同样适用于没有商店的LTSB/C发行版)
根据微软文档,需要手动下载安装Ubuntu 16.04 LTS
安装前需要在appwiz.cpl中启用WSL功能
安装
任意路径打开PowerShell输入以下命令,大约200M等待下载
PS C:\Users\Azure> Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile Ubuntu.appx -UseBasicParsing
# Downloading...
PS C:\Users\Azure> Add-AppxPackage .\Ubuntu.appx
完成安装后会设置UNIX账号密码即可使用
换源
众所周知,国内想要偷税的get还得换阿里源
打开wsl终端,先备份后替换
$ cd /etc/apt
$ sudo mv sources.list sources.list.bak
$ sudo nano sources.list
粘贴如下信息, Ctrl+X保存退出
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
之后使用sudo apt update更新一下,就可以愉快的get了
(如遇抽风,试试清华源)
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse
环境
Ubuntu16.04 LTS系统自带python 3.5,需手动安装2.7
$ sudo apt install python
参考