错误:搜索时找不到有效的 SPARK_HOME:(Windows 中的 Pycharm) [英] Error: Could not find valid SPARK_HOME while searching: (Pycharm in windows)
问题描述
我是 PYCHARM 的新手.当我尝试执行简单代码时,我已经正确配置了所有内容,但仍然面临以下问题搜索时找不到有效的 SPARK_HOME:
I am new to PYCHARM. I have configured everything properly but still facing below issue, when i try to execute simple code
Could not find valid SPARK_HOME while searching:
在项目解释器中,我更新了 PYTHON、PY4J.zip、PYSPARK.zip 和 SPARK 的路径直到 bin(不包括 bin)
In project interpreters i have updated the paths for PYTHON, PY4J.zip, PYSPARK.zip and SPARK till bin (bin not included)
版本如下:
Python version - 3.6.4
Spark - 2.2.1
我需要配置什么吗?
推荐答案
我不确定您是如何配置的.所以你可以使用下面的代码进行配置.
I am not sure how you have configured. So you can use below code for configuration.
这里我使用了 HADOOP_HOME 的 winutils 路径,如果您使用的是 Hadoop,请提及正确的 hadoop_home 路径.
Here i have used winutils path for HADOOP_HOME, If you are using Hadoop please mention proper hadoop_home path.
import sys
import os
os.environ['SPARK_HOME'] = "C:/Users/LZ/Spark"
os.environ['HADOOP_HOME'] = "C:/Users/LZ/winutils"
sys.path.append("C:/Users/LZ/Spark/python")
sys.path.append("C:/Users/LZ/Spark/python/lib")
执行上述代码后,您可以在 PYCHARM 中运行您的代码.希望这有帮助
After implementing above code you may able to run your code in PYCHARM. Hope this helps
这篇关于错误:搜索时找不到有效的 SPARK_HOME:(Windows 中的 Pycharm)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!