我試圖在Ubuntu 16.04.3在VirtualBox上設置OCaml。我對他們都是新手;請原諒我的無知。我使用emacs ocaml REPL:「搜索程序:沒有這樣的文件或目錄,ocaml」
wget https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh -O - | sh -s /usr/local/bin
安裝opam
,並根據以下的opam
安裝說明添加
. /home/<username>/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
我~/.profile
文件。我使用opam install tuareg
和GNU emacs 24.5.1
使用sudo apt-get install emacs
來安裝tuareg
。
當我試圖在Emacs中鍵入M-x run-ocaml
和return
使用ocaml
REPL,我OCaml REPL to run: ocaml
;當我再次打enter
,我
Searching for program: no such file or directory, ocaml
然後我試圖M-x shell
,看看我是否可以運行外殼ocaml
,我發現我需要使用opam switch
我想從終端/ shell中運行ocaml
每次;如果我直接鍵入ocaml
,我會得到
The program 'ocaml' is currently not installed. You can install it by typing: sudo apt-get install ocaml-interp
我不知道這是否有什麼關係,我發現了問題。
作爲第二次嘗試,我又回到了Emacs和類型M-x run-ocaml
,打return
,並在OCaml REPL to run:
再次命中return
(這次沒有ocaml
)。這開闢了一個新的緩衝區:
但是,當我試圖在新的緩衝區類的東西,說1+1;;
,並創下shift-return
,我得到Output file descriptor of OCaml is closed
,如上圖所示。
我一直在閱讀不同的文檔和線索的指示,但他們都沒有描述我的情況。任何幫助將非常感激!