【问题标题】:Install .NET Core on Google Colab在 Google Colab 上安装 .NET Core
【发布时间】:2020-06-01 20:25:37
【问题描述】:

我正在尝试在 Google Colab 上安装 .NET Core。我按照给出的说明进行操作(适用于 Ubuntu 17.10):

! wget -q https://packages.microsoft.com/config/ubuntu/17.10/packages-microsoft-prod.deb
! dpkg -i packages-microsoft-prod.deb
! apt-get install apt-transport-https
! apt-get update

在我尝试安装 aspnetcore-runtime-2.1 之前,这一切正常:

! apt-get install aspnetcore-runtime-2.1

并得到这个错误:

Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 aspnetcore-runtime-2.1 : Depends: dotnet-runtime-2.1 (>= 2.1.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

您可以清楚地看到缺少一个依赖项:dotnet-runtime-2.1。问题是我无法单独安装它,因此不存在依赖性问题。谁能帮我这个 ?

【问题讨论】:

标签: asp.net .net-core google-colaboratory


【解决方案1】:

Google colab 目前使用的是 ubuntu 版本 18.04.3。您可以使用它来检查它,

! lsb_release -a

因此,您需要关注 Microsoft guide 以获取该版本。 按顺序依次执行这些步骤。

! wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
! dpkg -i packages-microsoft-prod.deb
! add-apt-repository universe
! apt-get update
! apt-get install apt-transport-https
! apt-get update
! apt-get install dotnet-sdk-3.1

这是一个可工作的 colab 笔记本 -> https://colab.research.google.com/drive/19ZM4sIccSOgNjX3hQW0KUFsVbZCrGXTY

您可以检查它是否安装正确,

! dotnet --list-sdks

【讨论】:

  • 感谢您的帮助,我还有一个问题。我尝试安装一个包(! dotnet tool install -g Microsoft.Quantum.IQSharp),安装成功。虽然我无法执行它(它给了我这个错误:Could not execute because the specified command or file was not found.)。安装包后出现此消息:(===Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed.) 然后我重新启动了运行时,但它仍然没有工作,有什么提示吗?
  • 你用什么命令来执行Microsoft.Quantum.IQSharp
  • ! dotnet iqsharp install
  • 我相信所有功能在 colab 环境中都是不可能的。我发现了这个问题github.com/microsoft/iqsharp/issues/14 看看是否有帮助
  • 非常有帮助,你让我不必开车 2 小时才能拿到我的电脑!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-11-09
  • 2020-08-07
  • 2019-08-28
  • 2021-06-23
  • 2020-04-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多