python - 如何让 VSCode 将 Python3 识别为我的默认值
问题描述
我在我的 Mac 上安装了 python3,我在终端中,我默认使用 python3。但是,当我在 VSCode 中时,它没有将 python3 识别为我的默认值,它仍在使用 python2.7。
这是我的 VScode 环境的屏幕截图:我选择了 python3 的代码运行器以及我的解释器为 3.8
当我运行我的代码时,我得到了这个恼人的错误:
Exception: Python in worker has different version 2.7 than that in driver 3.8, PySpark cannot run with different minor versions. Please check environment variables PYSPARK_PYTHON and PYSPARK_DRIVER_PYTHON are correctly set.
我必须打电话export PYSPARK_PYTHON=python3
让我的代码运行,但我已经在我的 bash.profile 中内置了它。
为了让它正常运行,我缺少什么?
解决方案
除非您从终端窗口运行代码,否则不清楚为什么要导出内容。您的终端未连接到 vscode 设置。
如果要应用该环境,则需要从 vscode 实际运行脚本
推荐阅读
- javascript - 有没有办法在推特嵌入式小部件中更新推文列表时通知?
- javascript - 如何映射包含另一个我想要映射的对象并从中返回 JSX 的对象?
- database - 如何从 oracle 中的 Base64 字符串中删除 '\r\n'?
- json - 当我将 JSON 数据渲染到 html 元素时,return str.replace(/\n\r?/g, "
") 不起作用 - javascript - Angular6:当 url 清楚地显示正确的值时,为什么 `ActivatedRoute.snapshot.queryParams` 为空?
- angular - 如何使用 d3.js 合并国家以制作地理地图?
- ionic-framework - 如何使用 ionic devapp 运行本机相机
- python - 将软件包安装到 Anaconda 环境
- r - R - 如何使用准引号动态构造变异函数名称
- mql5 - 在 mql5 中处理 json 字符串