使用MacPorts安装Scala后,找不到scala命令

发布于 2024-12-08 16:54:59 字数 217 浏览 0 评论 0原文

我正在运行 Snow Leopard 并安装了 MacPorts。然后我安装了最新的(截至撰写本文时)Scala 版本:

$ sudo port install scala29

此后该怎么办?当我尝试执行 Scala 解释器时,我得到:

-bash: scala: command not found

I am running Snow Leopard and installed MacPorts. I then installed the latest (as of this writing) Scala version as:

$ sudo port install scala29

What to do after this? When I try to execute the Scala interpreter, I get:

-bash: scala: command not found

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

寒江雪… 2024-12-15 16:54:59

我正在使用 MacPorts 2.1.2,情况似乎又发生了一些变化。

$ sudo port select --list scala

显示

Available versions for scala:
    none (active)
    scala2.9

nezda 建议的命令无法正常工作:
$ sudo port select --set scala2.9

给出错误

Error: The 'set' command expects two arguments: <group>, <version>

但以下帮助

$ sudo port select --set scala scala2.9

激活 Scala 2.9

Selecting 'scala2.9' for 'scala' succeeded. 'scala2.9' is now active.

再次检查 scala

$ sudo port select --list scala
Available versions for scala:
        none
    scala2.9 (active)

我现在可以运行 Scala。

I'm using MacPorts 2.1.2 and things seems to changed a bit again.

$ sudo port select --list scala

Shows

Available versions for scala:
    none (active)
    scala2.9

Command suggested by nezda does not work properly:
$ sudo port select --set scala2.9

gives error

Error: The 'set' command expects two arguments: <group>, <version>

But following helps

$ sudo port select --set scala scala2.9

Activates Scala 2.9

Selecting 'scala2.9' for 'scala' succeeded. 'scala2.9' is now active.

Checking scala again

$ sudo port select --list scala
Available versions for scala:
        none
    scala2.9 (active)

And I can run Scala now.

朮生 2024-12-15 16:54:59

这似乎已经改变了。在 Lion + MacPorts 2.1.1 上,我必须执行以下操作:

验证这显示了版本:

    sudo port select --list scala

我的显示:

    Available versions for scala:
        none (active)
        scala29

如果没有选择,可以使用以下命令来选择:

    sudo port select --set scala scala29

打开一个新终端(确保 $PATH 是最新的)并验证 scala 现在是 2.9.x。

This seems to have changed. On Lion + MacPorts 2.1.1, I had to do the following:

Verify this shows the version:

    sudo port select --list scala

Mine showed:

    Available versions for scala:
        none (active)
        scala29

If it is not selected, you can use this command to select it:

    sudo port select --set scala scala29

Open a new terminal (ensuring $PATH is up to date) and verify scala is now 2.9.x.

余生再见 2024-12-15 16:54:59

好的,所以我实际上必须搜索这个,因为自上次执行以来 Scala 安装已经发生了变化。可执行文件应该从 /opt/local/bin 链接,要在不给文件夹添加前缀的情况下使用它们,请执行以下操作:

cd /opt/local/bin
sudo scala_select scala29

现在您应该能够从任何目录运行 scala 命令。

截至 2013 年 1 月,此答案已过时,Arnost Valicek 的答案已知有效。

Okay, so I actually had to search this since the Scala install has changed since the last time I did it. The executables should have been linked from /opt/local/bin, to use them without prefixing the folders do this:

cd /opt/local/bin
sudo scala_select scala29

Now you should be able to run the scala command from any directory.

As of January 2013 this answer is outdated, Arnost Valicek's answer is known to work.

一腔孤↑勇 2024-12-15 16:54:59

我认为是:

sudo port select --set scala scala29

I think it's:

sudo port select --set scala scala29
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文