微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

WSL:Cabal 无法解决依赖关系容器,二进制

如何解决WSL:Cabal 无法解决依赖关系容器,二进制

我对使用 haskell 和 cabal 还很陌生,我正在尝试使用 cabal install --lib plot 安装软件包 haskell package plot,我得到了这个

Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: binary-0.8.8.0/installed-0.8.8.0 (user goal)
[__1] next goal: containers (user goal)
[__1] rejecting: containers-0.6.4.1 (conflict: binary =>
containers==0.6.2.1/installed-0.6.2.1)
[__1] rejecting: containers-0.6.3.1,containers-0.6.2.1/installed-0.6.2.1,containers-0.6.2.1,containers-0.6.1.1,containers-0.6.0.1,containers-0.5.11.0,containers-0.5.10.2,containers-0.5.10.1,containers-0.5.9.2,containers-0.5.8.2,containers-0.5.7.1,containers-0.5.7.0,containers-0.5.6.3,containers-0.5.6.2,containers-0.5.6.1,containers-0.5.6.0,containers-0.5.5.1,containers-0.5.5.0,containers-0.5.4.0,containers-0.5.3.1,containers-0.5.3.0,containers-0.5.2.1,containers-0.5.2.0,containers-0.5.1.0,containers-0.5.0.0,containers-0.4.2.1,containers-0.4.2.0,containers-0.4.1.0,containers-0.4.0.0,containers-0.3.0.0,containers-0.2.0.1,containers-0.2.0.0,containers-0.1.0.1,containers-0.1.0.0,containers-0.5.9.1,containers-0.5.8.1
(constraint from user target requires ==0.6.4.1)
[__1] fail (backjumping,conflict set: binary,containers)
After searching the rest of the dependency tree exhaustively,these were the
goals I've had most trouble fulfilling: binary,containers,ghc

我尝试分别安装容器和二进制文件,但我遇到了类似的错误

解决方法

当您使用 cabal install --lib 而没有确切了解它的作用时会发生这种情况。简而言之,它不适合拥有不断更新的全局库集。真的只能用一次。要再次使用它,您必须删除它创建的环境文件,并将它与您希望在单个 cabal 调用中可用的完整库列表一起使用。老实说,这很痛苦,而且在几乎所有情况下,使用 cabal 文件都是一种更好的工作方式。

新建一个目录,在里面运行cabal init,把你需要的包添加到生成的cabal文件中,把你的代码放到生成的Main.hs中,用cabal repl做实验,用{{1}运行}}。它不必比这更复杂,而且您可以通过相互独立地固定软件包版本来避免给自己带来额外的问题。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。