OCaml: Can't run utop after installing it

前端 未结 4 1308
北荒
北荒 2021-02-20 10:42

I\'m trying to learn OCaml through the Real World OCaml book. They have a guide by which I am supposed to install the Core package and utop. However, while I seem to be successf

4条回答
  •  别那么骄傲
    2021-02-20 11:20

    The methods to install OCaml utop in ubuntu in most of the online resources seem like kind of misleading users. The thing is when installing opam with sudo apt-get command there is no need to install OCaml again using same command because OCaml came with opam installation. so only thing you have to do is to correctly initialize the state of the opam which defines the OPAM root in your home folder.

    So if you have installed any OCaml earlier first remove them to avoid conflicts.

    sudo apt-get purge --auto-remove ocaml-source
    sudo apt-get purge opam
    

    then install opam.

    sudo add-apt-repository ppa:avsm/ppa
    sudo apt-get update
    sudo apt-get install opam
    

    initialize the state of the opam

    opam init
    

    if it shows a dependency missing warning try this commands,

    opam install depext
    opam depext conf-m4.1
    

    then verify ocaml installation,

    eval 'opam config env'
    ocaml
    

    install UTop then,

    opam install utop
    eval `opam config env`
    utop
    

    for detailed information and handle errors please refer this blog post.

提交回复
热议问题