简体   繁体   English

如何将我的 Visual Studio Code 终端上的 python 版本 2.7.16 更改为更新的 python 版本?

[英]How change the python version 2.7.16 on my Visual Studio Code terminal to the newer python version?

I recently downloaded VS Code however the python version the VS CODE terminal is 2.7.16 but the python on my mac terminal is 3.8.5.我最近下载了 VS Code,但是 python 版本,VS CODE 终端是 2.7.16,但我的 mac 终端上的 python 是 3.8.5。 How can I change the python version to the latest on the VS code terminal?如何在 VS 代码终端上将 python 版本更改为最新版本?

macOS# The system install of Python on macOS is not supported. macOS# 不支持在 macOS 上系统安装 Python。 Instead, an installation through Homebrew is recommended.相反,建议通过 Homebrew 安装。 To install Python using Homebrew on macOS use brew install python3 at the Terminal prompt.要在 macOS 上使用 Homebrew 安装 Python,请在终端提示符下使用 brew install python3 。

Note On macOS, make sure the location of your VS Code installation is included in your PATH environment variable.注意 在 macOS 上,确保 VS Code 安装位置包含在 PATH 环境变量中。 See these setup instructions for more information.有关详细信息,请参阅这些设置说明。

for reference: click here to view official vs code documentation供参考:点此查看官方vs代码文档

You need to execute Python: Select Interpreter (shortcut: Ctrl+Shift+P ) command to switch the python environment in the VSCode.需要执行Python: Select Interpreter (快捷键: Ctrl+Shift+P )命令在VSCode中切换python环境。

The environment of python which you are using was displayed at the bottom left of the VSCode, and you can click it directly to switch the environment.你正在使用的python的环境显示在VSCode的左下方,可以直接点击切换环境。

Hopefully you've solved that problem.希望你已经解决了这个问题。 If not, these solved the problem for me:如果没有,这些解决了我的问题:

  1. Launch VS Code.启动 VS 代码。
  2. Open the Command Palette (Cmd+Shift+P) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.打开命令面板 (Cmd+Shift+P) 并输入“shell 命令”以找到 Shell 命令:在 PATH 命令中安装“代码”命令。

For more information: https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line更多信息: https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line

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

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