我想在Scala程序中运行python脚本,我在spark-shell中运行了python脚本,但是我在Scala IDE中尝试过相同的代码它会抛出"没有这样的文件或目录"。
我在spark-shell中的代码: - python文件:a.py
scala脚本: -
file="a.py"
Seq("python",file) !
上面的代码在spark-shell中成功运行,我在Scala IDE中尝试了相同的代码
object newtest {
def runpython(file:String)={
Seq("python",file) !
}
def main(args: Array[String]):Unit={
val file="/sample/a.py"
runpython(file)
}
}
注意: - " / sample"是scala IDE中的项目文件夹
请帮我解决这个问题。
谢谢, 普拉萨德。
答案 0 :(得分:0)
我猜想丢失的文件是python
尝试设置python可执行文件的完整路径