简体   繁体   English

OCaml - 无法安装Core

[英]OCaml - cannot install Core

My question is similar to this post: 我的问题类似于这篇文章:

OCaml: Can't run utop after installing it OCaml:安装后无法运行utop

I try to open the core library, and end up with the same problem: 我尝试打开核心库,最终遇到同样的问题:

$ open Core.Std
Couldn't get a file descriptor referring to the console

I have tried the following command with correct quote mark: 我用正确的引号尝试了以下命令:

eval `opam config env`

But nothing happens and the problem persists despite I have installed core. 但是没有任何反应,尽管我已经安装了核心,但问题仍然存在。 I also tried to follow installation instructions on this webpage ( https://github.com/realworldocaml/book/wiki/Installation-Instructions ), but it does not mention this strange problem. 我也尝试按照这个网页上的安装说明( https://github.com/realworldocaml/book/wiki/Installation-Instructions ),但它没有提到这个奇怪的问题。

I am using Ubuntu 24 in virtual machine by Hyper-V on windows 8. Another question I want to ask is many webpages like ( http://kwangyulseo.com/2014/03/04/installing-ocamlopamutopcore-library-on-ubuntu-saucy/ ) suggested to compile certain lines of command in ".ocamlinit file". 我在Windows 8上通过Hyper-V在虚拟机中使用Ubuntu 24。另一个我想问的问题是很多网页,如( http://kwangyulseo.com/2014/03/04/installing-ocamlopamutopcore-library-on-ubuntu -saucy / )建议在“.ocamlinit文件”中编译某些命令行。 But I do not know where to find this file and how to modify it in linux. 但我不知道在哪里可以找到这个文件以及如何在linux中修改它。 I have been an windows user for most of the time in my life. 在我生命中的大部分时间里,我一直是Windows用户。

Sorry if the question's level is too low. 对不起,如果问题的级别太低了。

Oh, man. 天啊。 open Core.Std is not a bash command. open Core.Std不是bash命令。 You need to open OCaml toplevel (ie to execute utop or ocaml ) and execute this command there. 您需要打开OCaml toplevel(即执行utopocaml )并在那里执行此命令。 Probably it is not written explicitly in manual . 可能它没有在手册中明确写出来。 If you see 如果你看到

#use "topfind";;
#thread;;
#camlp4o;;
#require "core.top";;
#require "core.syntax";;

It means that you should enter (or add to .ocamlinit) this by hand. 这意味着您应该手动输入(或添加.ocamlinit)。 I mean that you should enter # too. 我的意思是你也应该输入# So, if you will use ocaml you will see two # . 所以,如果你使用ocaml你会看到两个# It's normal. 这是正常的。

About OCaml init file. 关于OCaml init文件。 As you see they refer to it as ~/.ocamlinit . 如你所见,他们称之为~/.ocamlinit Character ~ means home directory in POSIX systems. 字符~表示POSIX系统中的主目录。 So you will probably need some GUI text editor ( gedit or kwrite , for example), create new file, put content there ans save it you home directory. 因此,您可能需要一些GUI文本编辑器(例如geditkwrite ),创建新文件,将内容放在那里并将其保存到主目录中。 NB POSIX systems have no concept of file extension, ie leading dot is part of file name. NB POSIX系统没有文件扩展名的概念,即前导点是文件名的一部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM