更新 Scala 版本 [英] Updating scala version

查看:29
本文介绍了更新 Scala 版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更新一个 Scala 版本.我知道它是为使用 scalaVersion 函数的项目完成的,但我还想更新我在终端中键入 scala 时使用的默认 scala 版本.

I want to update a Scala version. I know it be done for a project using scalaVersion function, but I also want to update a default scala version which is used when I type scala in the terminal.

现在我有 2.10.1 Scala 版本.

Now I have 2.10.1 scala version.

我该怎么做?

推荐答案

来自 http://osgux.tumblr.com/post/44635945407/install-scala-2-10-0-in-ubuntu:

$ wget http://www.scala-lang.org/downloads/distrib/files/scala-2.10.3.tgz
$ tar zxf scala-2.10.3.tgz
$ sudo mv scala-2.10.3 /usr/local/scala
$ sudo ln -s /usr/local/scala/bin/scala /usr/local/bin/scala
$ sudo ln -s /usr/local/scala/bin/scalac /usr/local/bin/scalac
$ sudo ln -s /usr/local/scala/bin/fsc /usr/local/bin/fsc
$ sudo ln -s /usr/local/scala/bin/sbaz /usr/local/bin/sbaz
$ sudo ln -s /usr/local/scala/bin/sbaz-setup /usr/local/bin/sbaz-setup
$ sudo ln -s /usr/local/scala/bin/scaladoc /usr/local/bin/scaladoc
$ sudo ln -s /usr/local/scala/bin/scalap /usr/local/bin/scalap

如果你只是想为自己安装它,而不是机器上的每个人,请将 /usr/local/scala 替换为 ~/tools/scala(或主文件夹的其他子文件夹)和 /usr/local/bin~/bin.

If you just want to install it for yourself, and not for everyone on the machine, replace /usr/local/scala with ~/tools/scala (or some other subfolder of your home folder) and /usr/local/bin with ~/bin.

评论回复:

由于您已经安装了 Scala,您可以使用命令 which scala 查看放置 Scala 脚本的位置.有两种可能:

Since you already have Scala installed, you can look where Scala scripts are placed by using the command which scala. There are two possibilities:

  1. 如果你看到 /opt/scala/scala2.10-1/bin/scala,这意味着 /opt/scala/scala2.10-1/bin 在您的 $PATH 中.找到添加的位置,替换为/opt/scala/scala-2.10.3/bin.一些可能的位置是 ~/.profile~/.bash-profile~/.bashrc,在 https://help.ubuntu.com/community/EnvironmentVariables(注意它列出了我提到的不推荐的文件"",但它们仍然被广泛使用).

  1. if you see /opt/scala/scala2.10-1/bin/scala, this means /opt/scala/scala2.10-1/bin is in your $PATH. Find where it is added, and replace it with /opt/scala/scala-2.10.3/bin. Some likely places are ~/.profile, ~/.bash-profile, ~/.bashrc, see others in https://help.ubuntu.com/community/EnvironmentVariables (note that it lists the files I mentioned as "not recommended", but they are still widely used).

如果您看到 /usr/local/bin/scala(或除 /opt/scala/scala2.10-1/bin 之外的其他文件夹),你应该用这样的链接替换这些文件:

If you see /usr/local/bin/scala (or some other folder other then /opt/scala/scala2.10-1/bin), you should replace these files with links like this:

    $ sudo ln -sf /opt/scala/scala-2.10.3/bin/scala /usr/local/bin/scala

(当然,如果不是 /usr/local/bin,则使用正确的文件夹).请注意,ln -s 的第一个参数是您要链接到的文件,第二个参数是您创建的链接,-f 删除现有的目标文件.

(of course, using the correct folder if it isn't /usr/local/bin). Note that the first argument of ln -s is the file you are linking to, the second argument is the link you create, and -f removes the existing destination files.

这篇关于更新 Scala 版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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