wsl安裝Ubuntu16.04+Python2.7


准備

因開發需要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

參考

手動下載適用於 Linux 的 Windows 子系統發行版包


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM