简体   繁体   English

更改数据块上的 PATH 环境变量

[英]change PATH env variable on databricks

I need to update my python path so that I can use python3 on databricks.我需要更新我的 python 路径,以便我可以在 databricks 上使用 python3。

On databricks notebook:在数据块笔记本上:

  %sh
  echo $PATH

  /databricks/python2/bin:/databricks/python3/bin:/usr/local/sbin

Then, I run:然后,我运行:

  %sh
  export PATH=/databricks/python3/bin:$PATH

But, I still got:但是,我仍然得到:

  %sh
  echo $PATH

  /databricks/python2/bin:/databricks/python3/bin:/usr/local/sbin

How can I change PATH?如何更改路径? Also, when I created a cluster on databricks, the python version is 3.6 but why python2 is used ?另外,当我在 databricks 上创建集群时,python 版本是 3.6 但为什么使用 python2?

thanks谢谢

According to the offical document Cluster Configurations / Databricks Runtime / Python version of Databricks, it sounds like your current databricks cluster is created for Runtime 5.5 or below with Python 2, because the databricks runtime version above 5.5 only supports Python 3, as the figure below.根据Cluster Configurations / Databricks Runtime / Python version的官方文档Cluster Configurations / Databricks Runtime / Python version of Databricks,听起来你现在的databricks集群是为Runtime 5.5或以下使用Python 2创建的,因为5.5以上的databricks运行时版本只支持Python 3,如下图.

在此处输入图片说明

So if you only want to use Python 3 in databricks, you just need to create a cluster which runtime version above 5.5.所以如果你只想在 databricks 中使用 Python 3,你只需要创建一个运行时版本高于 5.5 的集群。

Or if you have to use Runtime 5.5, please create a new cluster to specify Python 2. Note: I tried to set the environment variable PYSPARK_PYTHON with the Python 3 path via %sh export PYSPARK_PYTHON=.... on a existing running cluster, it do not work.或者,如果您必须使用 Runtime 5.5,请创建一个新集群来指定 Python 2。 注意:我尝试在现有运行集群上通过%sh export PYSPARK_PYTHON=....使用 Python 3 路径设置环境变量PYSPARK_PYTHON ,它不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM