如何让 Visual Studio Code 使用不同的 Python 解释器? [英] How do you get Visual Studio Code to use different Python interpreter?

查看:35
本文介绍了如何让 Visual Studio Code 使用不同的 Python 解释器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 VS Code/Python 的新手,我正在尝试让 VSCode 运行特定版本的 Python(似乎我安装了多个版本).

I'm new to VS Code/Python, and I'm trying to get VSCode to run a specific version of Python (seems I have multiple versions installed).

我尝试了以下代码:

import sys
print(sys.version)

当我运行文件时,出于某种原因,它显示:

When I run the file, some reason, it shows:

  3.5.2 |Anaconda 4.2.0 (32-bit)| (default, Jul  5 2016, 11:45:57) [MSC v.1900 32 bit (Intel)]

我尝试了以下方法:在VSCode的最底部,我点击了Python版本,然后点击了Python 3.7.3 64-bit",但是当我重新运行代码时,它仍然显示3.5​​.2 |Anaconda..."

I've tried the following: At the very bottom of VSCode, I clicked on the Python version, then clicked on "Python 3.7.3 64-bit", but when I reran the code, it still shows "3.5.2 |Anaconda..."

我也试过检查设置,结果显示:

I also tried checking the settings, and it's showing:

  Python: Python Path
    C:\Users\[MY_USE_NAME]\AppData\Local\Programs\Python\Python37-32\python.exe

我也尝试在命令中输入python",但它仍然显示Python 3.5.2".

I also tried just typing "python" in the command like, and it still says "Python 3.5.2".

知道我做错了什么吗?我对 VS Code 很陌生,所以希望它很简单.

Any idea what I'm doing wrong? I'm very new to VS Code, so hopefully it's something simple.

推荐答案

使用 F1 打开命令面板(在 Windows 上)并输入 Python: Select Interpreter.

Open command pallete with F1 (on Windows) and type Python: Select Interpreter.

这篇关于如何让 Visual Studio Code 使用不同的 Python 解释器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆