我在设置 OCaml 环境设置时遇到一些问题,正在关注此页面:
https://github.com/realworldocaml/book/wiki/Installation-Instructions
但是,我遇到了一些无法解决的问题。我使用的是 macOS 10.12.5,正在使用 zsh。
Brew 安装 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
出于问题的目的,我展示了我对安装基地的尝试,但最终想安装核心、乌托普、绿洲等......任何帮助将不胜感激!
编辑:当我应该使用反引号('(时,我正在使用撇号('(。我想是一个没有经验的外壳用户的证据......
当你这样做时,你应该使用反引号(在许多键盘上1
键的左侧找到(
eval `opam config env`
如果在查找反引号时遇到问题,则可以使用替代 shell 语法
eval $(opam config env)
注意:此命令不应打印任何内容,您看到环境变量值的事实表明您调用错误(此变量应由 shell 看到(。