有没有办法指定 raco 应该在哪里安装软件包?

Is there a way to specify where raco should install a package?

许多语言的包管理系统在给定项目的根存储库的子文件夹中安装第三方包。 (例如 node_modules/deps/ 等)这很好,因为它允许单个包的多个版本很好地共存,因为每个版本都与依赖它的项目隔离。

raco 默认情况下似乎在系统范围内安装软件包。有没有办法告诉 raco 它应该在特定文件夹中安装软件包?

该评论将您指向 package scopes:使用目录包范围是包管理器级别可用的最高 fine-grained 控制级别。但是,正如文档所说,

Conflict checking disallows installation of the same or conflicting package in different scopes …

Racket 包系统的设计决定不允许同一包的多个版本共存于同一安装中。这个想法是一个包不应该在使用相同的名称时进行重大更改。提到的一个灵感是 OS 级别的包系统,如 Debian 的,其中 gcc-4.7gcc-4.8 是安装不同二进制文件的不同包。这与其他一些语言包系统(例如 npm)的做法非常不同,但在实践中效果很好,因为 Racket 社区非常重视 backwards-compatibility。

这其实是Racket的第二个包系统。旧系统,PLaneT, tried to be much more opinionated, including built-in notions of versioning. The new/current system consciously removed some of those elements to create a more minimal and focused package system, which means that a great deal of what formerly had to be "built in" to Racket can now be just another package. You may be interested in a talk about the design of the package system. There was also a fair amount of discussion at the time on the mailing list, which is archived here.

如果你确实发现你需要不同的包版本到现有机制无法支持的程度,你可以使用 stand-alone Racket 安装(而不是 system-wide 安装)来得到一个完全隔离的环境。我相信 Racket 社区也有兴趣了解您在实践中遇到的任何问题。