博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
macos 安装scala_如何在MacOS上安装Scala和Apache Spark
阅读量:2539 次
发布时间:2019-05-11

本文共 3907 字,大约阅读时间需要 13 分钟。

macos 安装scala

by Jose Marcial Portilla

通过何塞·马西尔·波蒂利亚(Jose Marcial Portilla)

如何在MacOS上安装Scala和Apache Spark (How to Install Scala and Apache Spark on MacOS)

Here is a Step by Step guide to installing Scala and Apache Spark on MacOS.

这是在MacOS上安装Scala和Apache Spark的分步指南。

步骤1:自制软件 (Step 1: Get Homebrew)

Homebrew makes your life a lot easier when it comes to installing applications and languages on a Mac OS. You can get Homebrew by following the instructions on it’s .

在Mac OS上安装应用程序和语言时,Homebrew使您的生活变得更加轻松。 您可以按照其上的说明获得Homebrew。

Which basically just tells you to open your terminal and type:

这基本上只是告诉您打开终端并输入:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

There are more detailed instructions on installing on the project’s Installing everything through Homebrew should automatically add all the appropriate PATH settings to your profile.

在项目的上有关于安装的更多详细说明 通过Homebrew安装所有内容后,应会自动将所有适当的PATH设置添加到您的配置文件中。

步骤2:安装xcode-select (Step 2: Installing xcode-select)

In order to install Java, Scala, and Spark through the command line we will probably need to install xcode-select and command line developer tools. Go to you terminal and type:

为了通过命令行安装Java,Scala和Spark,我们可能需要安装xcode-select和命令行开发人员工具。 在您的终端上输入:

xcode-select --install

You will get a prompt that looks something like this:

您将看到如下提示:

Go ahead and select install.

继续并选择安装。

步骤3:使用Homebrew安装Java (Step 3: Use Homebrew to install Java)

Scala is dependent on Java, you may or may not need to install it. The easiest way to install it is to just use HomeBrew:

Scala依赖于Java,您可能需要也可能不需要安装它。 安装它的最简单方法是只使用HomeBrew:

In your terminal type:

在您的终端中输入:

brew cask install java

You may need to enter your password at some point to complete the java installation. After running this Homebrew should have taken care of the Java install. Now we can move on to Scala.

您可能需要在某些时候输入密码才能完成Java安装。 运行此Homebrew之后,应该已经完成​​了Java安装。 现在我们可以转到Scala。

步骤4:使用Homebrew安装Scala (Step 4: Use Homebrew to install Scala)

Now with Homebrew installed go to your terminal and type:

现在安装好Homebrew后,转到终端并输入:

brew install scala

步骤5:使用Homebrew安装Apache Spark (Step 5: Use Homebrew to install Apache Spark)

Now with Scala installed go to your terminal and type:

现在安装了Scala后,转到您的终端并输入:

brew install apache-spark

Homebrew will now download and install Apache Spark, it may take some time depending on your internet connection.

Homebrew现在将下载并安装Apache Spark,这可能需要一些时间,具体取决于您的Internet连接。

步骤5:启动Spark Shell (Step 5: Start the Spark Shell)

Now try this command:

现在尝试以下命令:

spark-shell

You should see a flood of text and warnings but eventually see something like this:

您应该看到大量的文字和警告,但最终会看到类似以下的内容:

Welcome to      ____              __     / __/__  ___ _____/ /__    _\ \/ _ \/ _ `/ __/  '_/   /___/ .__/\_,_/_/ /_/\_\   version 2.0.1      /_/
Using Scala version 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_102)Type in expressions to have them evaluated.Type :help for more information.
scala>

You can confirm that it is working by typing the scala code:

您可以通过输入scala代码来确认它正在运行:

val s = "hello world"

Congratulations! You’re all set up!

恭喜你! 你们都准备好了!

Common Issue: Setting PATH in bash.

常见问题:在bash中设置PATH。

Homebrew should have taken care of all of this, but in case you need to add spark to your PATH, you’ll want to use:

Homebrew应该已经解决了所有这些问题,但是如果您需要在PATH中添加spark,则需要使用:

export SPARK_HOME=/usr/local/Cellar/apache-spark/2.0.1/libexecexport PYTHONPATH=/usr/local/Cellar/apache-spark/2.0.1/libexec/python/:$PYTHONP$

Just type that straight into your terminal.

只需将其直接输入您的终端即可。

I’m Jose Portilla, and I teach over 200,000 students about programming, data science, and machine learning on Udemy. You can check out all my courses .

我是Jose Portilla,我在Udemy上为200,000多名学生提供有关编程,数据科学和机器学习的知识。 您可以查看我所有的课程。

If you’re interested in learning Python for Data Science and Machine learning, . (I also teach )

如果您对学习Python进行数据科学和机器学习感兴趣, 。 (我也教 )

翻译自:

macos 安装scala

转载地址:http://xhewd.baihongyu.com/

你可能感兴趣的文章
BZOJ 4443: 小凸玩矩阵【二分图】
查看>>
苹果 OS X制作u盘启动盘
查看>>
Jquery便利对象
查看>>
MVC: Connection String
查看>>
idea常用设置汇总
查看>>
Node.SelectNodes
查看>>
Lambda表达式语法进一步巩固
查看>>
Vue基础安装(精华)
查看>>
Git 提交修改内容和查看被修改的内容
查看>>
PAT - 1008. 数组元素循环右移问题 (20)
查看>>
请求出现 Nginx 413 Request Entity Too Large错误的解决方法
查看>>
配置php_memcache访问网站的步骤
查看>>
hibernate的id生成策略
查看>>
树莓派3B+学习笔记:5、安装vim
查看>>
[Spfa][bfs] Jzoj P5781 秘密通道
查看>>
企业帐号进行IPA的打包、分发、下载安装的详细流程(转载)
查看>>
《项目架构那点儿事》——快速构建Junit用例
查看>>
{"errmsg":"invalid weapp pagepath hint: [IunP8a07243949]","errcode":40165}微信的坑
查看>>
DB2V9.5数据库使用pdf
查看>>
Java Bigdecimal使用
查看>>