为什么cabal sandbox init不会像virtualenv那样更改PATH? [英] Why cabal sandbox init does not change PATH like virtualenv does?

查看:162
本文介绍了为什么cabal sandbox init不会像virtualenv那样更改PATH?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想我可能在这里错过了一些东西,但是如果你看看 Yesod's quickstart ,autor在 cabal sandbox init 之前安装一些软件包。我在其他地方看到过相同的模式。问题:


  1. 我错过了什么吗?这是真正的使用cabal沙箱的方式吗?

  2. 为什么不能(或者不应该)我在沙箱中安装yesod-bin?

  3. 如果我在一些项目中使用不同版本的yesod-bin,会怎样?

  4. 如果有一些库在.cabal-sandbox / bin中安装二进制文件,为什么 cabal sandbox init 不改变PATH以匹配沙盒版本

非常感谢前进!<​​/ p>

解决方案


  1. 是的,这个如何使用沙盒。



    cabal sandbox init 会为您创建一些文件/目录,以跟踪您安装的软件包。



    cabal install some_package 将安装该软件包到沙盒中。


  2. 欢迎您将 yesod-bin 安装到沙盒中。

  3. 阅读要点2


  4. cabal sandbox init doesn不会改变你的道路,因为它并不需要。只需在 .bash_profile 中添加 PATH = .cabal-sandbox / bin:$ PATH 即可。

    与virtual-env不同,您永远不需要启用或禁用沙箱。您只需 cd 到一个目录中,并且它会自动启用。



    我发现唯一真正的缺点是沙箱,是你需要在根目录下才能对沙箱进行操作。意思是说,如果你在一个子目录中,运行 cabal install some_package 不会将它安装到一个级别的沙箱中,而是将它安装到全局或用户数据库,具体取决于您如何配置 cabal



Haskell newbie and Python guy here.

I think I may be missing something here but if you look at Yesod's quickstart, the autor install some packages before cabal sandbox init. I have seen the same pattern elsewhere. Questions:

  1. Am I missing something? Is this the real way to use cabal sandbox?
  2. Why can't (or shouldn't) I install yesod-bin inside a sandbox?
  3. What if I use different versions of yesod-bin throughout some projects?
  4. If there is some libraries that install binaries inside .cabal-sandbox/bin, why cabal sandbox init don't change PATH in order to match the sandboxed version?

Thank you very much in advance!

解决方案

  1. Yes, this how to use a sandbox.

    cabal sandbox init will create some files / directories for you that will keep track of the packages you have installed.

    cabal install some_package will install that package into the sandbox.

  2. You are more than welcome to install yesod-bin into a sandbox.

  3. Read point 2

  4. cabal sandbox init doesn't change your path, because it doesn't really need to. Just add PATH=.cabal-sandbox/bin:$PATH in your .bash_profile.

    Unlike virtual-env, you never need to 'enable' or 'disable' a sandbox. You just cd into a directory, and it is automatically enabled.

    The only real downside I have found to cabal sandboxes, is that you need to be in the root directory in order to act upon a sandbox. Meaning, if you are in a sub-directory, running cabal install some_package will not install it into the sandbox that is up a level, instead it will install it into either the global or user database, depending on how you have cabal configured.

这篇关于为什么cabal sandbox init不会像virtualenv那样更改PATH?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆