为 Visual Studio Code 设置 PySpark 交互式环境Set up the PySpark interactive environment for Visual Studio Code

以下步骤显示如何在 VS Code 中设置 PySpark 交互环境。The following steps show you how to set up the PySpark interactive environment in VS Code.

我们使用 python/pip 命令在 Home 路径中生成虚拟环境 。We use python/pip command to build virtual environment in your Home path. 如果要使用其他版本,则需要手动更改默认版的 python/pip 命令 。If you want to use another version, you need to change default version of python/pip command manually. 有关详细信息,请参阅更新替代项More details see update-alternatives.

  1. 安装 Pythonpip.Install Python and pip.

  2. 通过运行以下命令,安装 virtualenv 。Install virtualenv by running command below.

    pip install virtualenv
    

其他包Other packages

如果遇到错误消息,请通过运行以下命令安装所需的包:If you encounter an error message, install the required packages by running the following commands:

libkrb5 包

sudo apt-get install libkrb5-dev
sudo apt-get install python-dev
  1. 重启 VS Code 并回到运行以下命令的脚本编辑器:“HDInsight: PySpark Interactive”。Restart VS Code, and then go back to the script editor that's running HDInsight: PySpark Interactive.

后续步骤Next steps

工具和扩展Tools and extensions