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

相关推荐
lllsure9 分钟前
【Docker】存储卷
运维·docker·容器
wheeldown14 分钟前
【Linux】 存储分级的秘密
linux·运维·服务器
不做菜鸟的网工24 分钟前
Headscale 的部署方法和使用教程
运维
天天进步201530 分钟前
掌握React状态管理:Redux Toolkit vs Zustand vs Context API
linux·运维·react.js
艾醒(AiXing-w)1 小时前
探索大语言模型(LLM):Ollama快速安装部署及使用(含Linux环境下离线安装)
linux·人工智能·语言模型
垚垚领先1 小时前
Kdump 文档 - 基于 kexec 的崩溃转储解决方案
linux
tongsound1 小时前
igh ethercat 实时性测试
linux·c++
大翻哥哥1 小时前
Python 2025:低代码开发与自动化运维的新纪元
运维·python·低代码
柯南二号1 小时前
【Java后端】Spring Boot 集成雪花算法唯一 ID
java·linux·服务器
半梦半醒*1 小时前
正则表达式
linux·运维·开发语言·正则表达式·centos·运维开发