spark-sql: command not found 问题解决

目录

问题

在这里插入图片描述
我在使用python的subprocess模块调用shell脚本时出现:spark-sql: command not found没有找到的问题。

解决

按照网上的思路是去/etc/profile配置文件里配置信息,然后我进入配置文件查看:vim /etc/profile
在这里插入图片描述
发现SPARK_HOME和PATH已经配置了,但是仍然出现该问题。所以猜想是配置文件没有生效的问题,所以在命令前加上:

source /etc/profile

这样的话问题就解决了:

subprocess.call("source /etc/profile; bash /home/tmp/train_data.sh", shell=True)

猜你喜欢

转载自blog.csdn.net/aruewds/article/details/126207989