win10 子系統(tǒng)的安裝及卸載

一、啟用“適用于Linux的Windows子系統(tǒng)(WSL)”

通過Win10任務(wù)欄中的Cortana搜索框搜索打開 “啟用或關(guān)閉Windows功能” ,向下滾動列表,即可看到“適用于Linux的Windows子系統(tǒng)(Beta)”項。


點擊啟用或關(guān)閉Windows功能


勾選 適用于Linux的 Windows子系統(tǒng)

勾選它,確定,然后按提示重啟系統(tǒng)。

二、啟用開發(fā)人員模式

然后進入“設(shè)置 - 更新和安全 - 針對開發(fā)人員”設(shè)置頁面,選中“開發(fā)人員模式”。如圖:

然后就會下載安裝開發(fā)人員模式程序包,等待安裝完成。

可以有兩種方法安裝

1. 第一種是在Microsoft store里面直接搜索Ubuntu進行安裝。(Ubuntu是Linux的發(fā)行版之一)直接搜索 ubuntu


直接下載完成直接啟動就可以

2. 第二種是在win10 命令行內(nèi)進行安裝。

右鍵點擊Win10開始按鈕,選擇“Windows PowerShell(管理員)”以管理員身份運行Windows PowerShell。

或者直接在搜索框輸入?Windows PowerShell 以管理員身份運行。


進入Windows下的命令行。命令行下輸入命令bash回車,它會問你是否安裝,輸入y繼續(xù)。(bash是Linux下的一個命令行)


輸入bash即可進入Linux子系統(tǒng)。

也可以直接打開在Microsoft store中下載的Ubuntu進入子系統(tǒng)。

初次進入Linux子系統(tǒng)需要設(shè)置Linux的用戶名及密碼。

之后就可以愉快地玩耍了

接下來就是配置了,首先更換軟件源(apt源和pip源)

系統(tǒng)默認(rèn)的apt源是國外的,下載軟件速度慢,python的pip源也很慢,我們都換成阿里云的源。

更換apt源:(備份一下)

cd /etc/apt/

sudo cp sources.list sources.list.bak && sudo vim sources.list

刪除其中所有內(nèi)容,替換成:vim 下 ?刪除所有行 的命令??:1,$d?

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?

deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse?

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse?

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse?

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse?

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse?

deb http://archive.canonical.com/ubuntu/ xenial partner?

deb http://extras.ubuntu.com/ubuntu/ xenial main

然后執(zhí)行

sudo apt update

sudo apt upgrade

修改pip源:

創(chuàng)建pip配置文件:

mkdir ~/.pip && vi ~/.pip/pip.conf

在打開的vim中輸入下文并保存:

[global]

trusted-host=mirrors.aliyun.com

index-url=http://mirrors.aliyun.com/pypi/simple/

完成,可以配置環(huán)境了

那么卸載呢???

打開命令提示符,輸入lxrun /uninstall /full,然后根據(jù)提示輸入y即可開始卸載。?

稍等片刻就好。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容