OPAM:我可以在不同的 shell 中同时使用不同的开关吗?

OPAM: Can I work on different switches at the same time in different shells?

这个问题在 OPAM FAQ [1] 中得到了解决,但是提供的两种解决方案都不适用于 OPAM v.1.2.2,因为 envexec 命令都是未知的。我怎样才能 运行 来自不同交换机的单个命令?

[1] https://opam.ocaml.org/doc/2.0/FAQ.html#Can-I-work-on-different-switches-at-the-same-time-in-different-shells

您已链接到 opam 2.0 的常见问题解答。这是针对 opam 1.2 的:https://opam.ocaml.org/doc/FAQ.html#Can-I-work-on-different-switches-at-the-same-time-in-different-shells

Can I work on different switches at the same time in different shells ?

Yes. Use one of:

eval $(opam config env --switch <switch>)        # for the current
shell opam config exec --switch <switch> -- <command>  # for one command

This only affects the environment.