2

我在设置 OCaml 环境时遇到了一些问题,我正在关注此页面:

https://github.com/realworldocaml/book/wiki/Installation-Instructions

但是,我遇到了一些我无法解决的问题。我在 macOS 10.12.5 上并且正在使用 zsh。

Brew 安装 opam 时没有错误或警告。我相信我的问题在于环境变量(??)不同步。以下是我运行一些建议的命令时的一些输出:

opam开关:

--     -- 4.04.2  Official 4.04.2 release
--     -- 4.05.0  Official 4.05.0 release
system  C system  System compiler (4.05.0)
# 251 more patched or experimental compilers, use '--all' to show

[WARNING] The environment is not in sync with the current switch.
          You should run: eval `opam config env`

评估“opam 配置环境”:

CAML_LD_LIBRARY_PATH="/Users/Alex/.opam/system/lib/stublibs:/usr/local/lib/ocaml/stublibs"; export CAML_LD_LIBRARY_PATH;
OPAMUTF8MSGS="1"; export OPAMUTF8MSGS;
MANPATH="/Users/Alex/.opam/system/man:"; export MANPATH;
PERL5LIB="/Users/Alex/.opam/system/lib/perl5"; export PERL5LIB;
OCAML_TOPLEVEL_PATH="/Users/Alex/.opam/system/lib/toplevel"; export OCAML_TOPLEVEL_PATH;
PATH="/Users/Alex/.opam/system/bin:/usr/local/opt/opencv3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/MacGPG2/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS"; export PATH;

opam 安装基础:

The following actions will be performed:
  ∗  install sexplib v0.9.2                   [required by base]
  ∗  install base    v0.9.3
===== ∗  2 =====
Do you want to continue ? [Y/n] y

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[base] Archive in cache
[sexplib] Archive in cache

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[ERROR] The compilation of sexplib failed at "jbuilder build -p sexplib -j 4".

#=== ERROR while installing sexplib.v0.9.2 ====================================#
# opam-version 1.2.2
# os           darwin
# command      jbuilder build -p sexplib -j 4
# path         /Users/Alex/.opam/system/build/sexplib.v0.9.2
# compiler     system (4.05.0)
# exit-code    127
# env-file     /Users/Alex/.opam/system/build/sexplib.v0.9.2/sexplib-35995-e7966f.env
# stdout-file  /Users/Alex/.opam/system/build/sexplib.v0.9.2/sexplib-35995-e7966f.out
# stderr-file  /Users/Alex/.opam/system/build/sexplib.v0.9.2/sexplib-35995-e7966f.err



=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following actions were aborted
  ∗  install base v0.9.3
The following actions failed
  ∗  install sexplib v0.9.2
No changes have been performed

出于问题的目的,我展示了我安装基础的尝试,但最终想安装核心、utop、绿洲等......非常感谢任何帮助!

编辑:当我应该使用反引号(`)时,我使用了撇号(')。我想一个没有经验的shell用户的证据......

4

1 回答 1

3

1你应该在做的时候使用反引号(在许多键盘上的键的左侧)

eval `opam config env`

如果您无法找到反引号,那么您可以使用另一种 shell 语法

eval $(opam config env)

注意:这个命令不应该打印任何东西,你看到环境变量的值表明你叫错了(这个变量应该被shell看到)。

于 2017-08-16T21:07:34.337 回答