使用 WSL Ubuntu 在 Windows 上安装 pand OCaml

问题描述 投票:0回答:1

我正在尝试使用 WSL 在 Windows 上安装 OCaml。 我按照以下说明操作:安装 WSL

所以我打开 PowerShell 并输入

wsl --install

重新启动后,我以管理员身份启动 Windows 命令提示符,这是我的输出:

C:\Windows\System32>ubuntu
Installing, this may take a few minutes...
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: florianingerl
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.153.1-microsoft-standard-WSL2 x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage


This message is shown once a day. To disable it please create the
/home/florianingerl/.hushlogin file.
florianingerl@FLORI-LENOVO-93:~$ bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)"
## Downloading opam 2.1.6 for linux on x86_64...
## Downloaded.
## Where should it be installed ? [/usr/local/bin]
Write access to '/usr/local/bin' required, using 'sudo'.
Command: install -m 755 /tmp/opam-2.1.6-x86_64-linux /usr/local/bin/opam
[sudo] password for florianingerl:
## opam 2.1.6 installed to /usr/local/bin
## Run this script again with '--restore ' to revert.
florianingerl@FLORI-LENOVO-93:~$ opam --version
2.1.6
florianingerl@FLORI-LENOVO-93:~$ ocaml --version
Command 'ocaml' not found, but can be installed with:
sudo apt install ocaml-interp
florianingerl@FLORI-LENOVO-93:~$ sudo apt install ocaml-interp
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package ocaml-interp
florianingerl@FLORI-LENOVO-93:~$ opam init -y
No configuration file found, using built-in defaults.
Checking for available remotes: rsync and local, git.
  - you won't be able to use mercurial repositories unless you install the hg command on your system.
  - you won't be able to use darcs repositories unless you install the darcs command on your system.

[WARNING] Recommended dependencies -- most packages rely on these:
  - make
  - cc
[ERROR] Missing dependencies -- the following commands are required for opam to operate:
  - unzip
  - bwrap: Sandboxing tool bwrap was not found. You should install 'bubblewrap'. See
    https://opam.ocaml.org/doc/FAQ.html#Why-does-opam-require-bwrap.

我对 Ubuntu 完全陌生。我只想安装 OCaml。 那么我现在如何通过 Opam 或其他方式安装 OCaml 编译器。如果需要先安装 unzip 或 bwrap,那么安装 unzip 或 bwrap 的命令是什么。安装了ocaml后如何安装dune?

ubuntu ocaml windows-subsystem-for-linux opam ocaml-dune
1个回答
1
投票

使用 opam 而不是操作系统包管理器来安装 ocaml 和 dune。

opam update
opam switch create 5.2.0

对于沙丘:

opam install dune
© www.soinside.com 2019 - 2024. All rights reserved.