windows 安装Linux子系统 Ubuntu 并配置python3

环境说明:

Windows 11 Ubuntu 20.04.6

安装步骤以及问题:

1、开启Windows Subsystem for Linux

bash 复制代码
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

2、开启虚拟机特性

bash 复制代码
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

3、下载并安装WSL2更新包

bash 复制代码
https://link.zhihu.com/?target=https%3A//wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

4、将WSL2设置成默认

bash 复制代码
wsl --set-default-version 2

注:以上命令均以powershell的管理员命令执行

若未执行以上命令,直接安装Linux子系统,会出现如下报错:

5、打开Microsoft store 获取(我已经安装,所以是打开,未安装则显示获取)

6、打开软件

配置用户名和密码,到此,安装结束

7、配置国内安装源(加快系统包安装速度)

备份配置文件:sudo cp /etc/apt/sources.list /etc/apt/sources_bk.list

修改配置文件:vim /etc/apt/sources.list

复制代码
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

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

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

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

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

将上述内容覆盖即可,

8、更新系统包列表

复制代码
sudo apt update

默认情况下,Ubuntu 20.04初始安装python3.8.10,但是未安装pip3

9、安装pip3

复制代码
sudo apt install python3-pip

此处,结束 20230920

相关推荐
开开心心_Every几秒前
实用PDF擦除隐藏信息工具,空白处理需留意
运维·服务器·网络·pdf·电脑·excel·依赖倒置原则
Hello World . .6 分钟前
Linux:Linux命令行音视频播放器
linux·音视频
qZ6bgMe437 分钟前
一个高性能的 .NET MQTT 客户端与服务器库
运维·服务器·.net
做cv的小昊12 分钟前
【conda】打包已有conda环境并在其他服务器上搭建
运维·服务器·python·conda·运维开发·pip·开发
Vfw3VsDKo13 分钟前
Android设备搭建本地RTSP服务器(基于live555)
android·运维·服务器
YYYing.15 分钟前
【Linux/C++网络篇(二) 】TCP并发服务器演进史:从多进程到Epoll的进化指南
linux·服务器·网络·c++·tcp/ip
zfoo-framework21 分钟前
[推荐]docker+jenkins+jenkinsfile+ansible实现多机批量部署
运维·jenkins·maven
SPC的存折23 分钟前
10、Ansible 生产级故障排查与运维最佳实践
linux·运维·ansible
aP8PfmxS233 分钟前
Lab3-page tables && MIT6.1810操作系统工程【持续更新】
java·linux·jvm
Jp7gnUWcI33 分钟前
.NET Win32磁盘动态卷触发“函数不正确”问题排查
运维·服务器·.net