我在设置我的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`
eval' opam config env':
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用户的证据......
答案 0 :(得分:3)
你应该使用反引号(在许多键盘的键1
的左侧找到)
eval `opam config env`
如果您在查找反引号时遇到问题,则可以使用其他shell语法
eval $(opam config env)
注意:此命令不应该打印任何内容,您看到环境变量的值表明您正在调用它(这个变量应该由shell看到)。