试图在Windows上使用bash并且没有安装分发消息

ddi*_*ppa 86 linux windows bash windows-subsystem-for-linux

我试图在Windows 10上使用bash,但在尝试运行bash时我收到此消息:

Windows子系统Linux没有已安装的发行版.可以通过访问Windows应用商店来安装发行版:https: //aka.ms/wslstore按任意键继续...

当我转到打开Windows应用商店应用程序的URL时,没有任何Linux发行版的迹象.

我的Windows版本是(如我右下角的屏幕):

Windows 10企业内幕预览.评估版.建立16215.rs_prerelease.170603-1840

我按照本指南" 安装指南"中的说明进行操作,并且还在观看此视频从Scott Hanselman 在Windows 10上的Windows Subsystem for Linux上编辑代码和文件,但他们没有得到没有安装发行版的消息.

任何帮助?

小智 161

当Windows商店打开时,没有Distro可供选择,然后我找到了这个命令lxrun /install并且也为我工作.

你会得到这样的东西作为输出:

C:\WINDOWS\system32>lxrun /install
Warning: lxrun.exe is only used to configure the legacy Windows Subsystem for Linux distribution.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore

This will install Ubuntu on Windows, distributed by Canonical and licensed under its terms available here:
https://aka.ms/uowterms

Type "y" to continue: y
Downloading from the Microsoft Store... 100%
Extracting filesystem, this will take a few minutes...
Would you like to set the Ubuntu locale to match the Windows locale (en-FI)?
The default locale is en_US.
Type "y" to continue: y
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: <you type your login here>
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Installation successful!
Documentation is available at:  https://aka.ms/wsldocs
Run Code Online (Sandbox Code Playgroud)

  • lxrun 在 Windows 2019 上似乎不存在 (6认同)
  • `lxrun` 被替换为 `wsl` (3认同)
  • 这是运行lxrun/install [在Windows上安装Bash]后的进程的打印屏幕(http://i.imgur.com/rjQ2iNe.png) (2认同)

Lev*_*evi 25

尝试卸载并重新安装后,我遇到了类似的错误.

对我来说,我必须以管理员身份打开cmd提示符并运行 lxrun /install


use*_*374 25

我最近重新启动时得到了这个.如果我等了5分钟,问题就解决了!

  • 我很高兴我找到了这个答案,我已经使用Linux子系统Linux一年多了,而今天当我刚开启笔记本电脑时,我第一次出现这个错误,我想我我将不得不从第一个答案运行`lxrun`命令或找到要安装的东西来修复它,但是看到这个答案后,我决定等待,你说对了,它确实在几分钟后开始工作. (4认同)
  • 如果您已经从商店安装了 linux 发行版,这很重要。 (2认同)
  • 我不知道为什么会这样,但是我不等5分钟重新启动LxssManager服务。 (2认同)

thi*_*ani 14

为这个问题写的最佳答案绰绰有余。我只是在跟随他们时遇到了麻烦,因为lxrun命令已被弃用,所以我收到了错误

'lxrun' 不是内部或外部命令,也不是可运行的程序或批处理文件。

当我尝试使用 cmd 运行此命令时。

它已被wsl命令替换。您可以在此处获取有关此问题的更多信息 - https://github.com/MicrosoftDocs/WSL/issues/425

当您运行 时wsl /install,您可能仍会收到之前在问题中发布的错误。在这种情况下,只需像之前一样转到https://aka.ms/wslstore链接。如果您没有看到任何内容,只需搜索 Ubuntu 并安装相同的。(wsl不过,如果您使用该术语进行搜索,您也会看到其他 Linux 版本,然后您可以下载任何您选择的版本)

  • 感谢您提到这一点。命令 lxrun /install 不起作用,但 wsl /install 起作用 (2认同)
  • 这个答案是最好的(2020年最新) (2认同)

Too*_*ofy 9

似乎命令中给出的链接不起作用.这是Ubuntu的微软商店的实际链接.

https://www.microsoft.com/en-nz/store/p/ubuntu/9nblggh4msv6?rtc=1


小智 7

您必须转到https://aka.ms/wslstore此链接并在 Windows 上下载 ubuntu。之后,您可以在 Windows 上使用 bash。


Art*_*iev 6

如果您在运行时遇到任何问题lxrun /install(例如在 ltsb Windows 版本上),请尝试手动模式。

首先,转到包含下载.appx文件的文件夹并运行以下命令(如果需要,更改文件名):

Rename-Item ~/Ubuntu.appx ~/Ubuntu.zip
Expand-Archive ~/Ubuntu.zip ~/Ubuntu
Run Code Online (Sandbox Code Playgroud)

完成后 cd 进入新文件夹并运行ubuntu.exe文件。就是这样。


小智 5

如果在使用Windows存储安装发行版后收到此错误,并且WSL以前运行正常,则可能需要确保LxssManager服务正在运行,因为它通常在Windows更新或重新启动后停止。

转到services.msc,搜索LxssManager并启动它;如果它已经在运行,请重新启动它。


Yas*_*man 5

对于每个获得

'lxrun' is not recognized as an internal or external command,
operable program or batch file.
Run Code Online (Sandbox Code Playgroud)

或者

Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore
Run Code Online (Sandbox Code Playgroud)

打开微软商店,安装“Ubuntu”,然后打开应用程序。这将安装 ubuntu,稍后您可以使用wsl命令,因为lxrun已弃用