【问题标题】:How do I change VSCode Python interpreter to Linux terminal on ubuntu 18.04?如何在 ubuntu 18.04 上将 VSCode Python 解释器更改为 Linux 终端?
【发布时间】:2022-01-19 07:48:40
【问题描述】:

所以我一直在尝试

import pandas as pd

还有

from tensorflow.keras.utils import to_categorical
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dence, Dropout

from sklearn.model_selection import train_test_split
from sklearn import preprocessing

这些是我的深度学习训练数据中的代码片段。我已经阅读了我在终端上安装了 pandas 和 tensorflow 的解决方案,这与在 vscode 上运行的 python 不同。

感谢任何帮助,因为我是编码新手。

【问题讨论】:

  • 不正确,VSC 使用安装在您系统上的 Python 解释器或使用该 Python 解释器的虚拟环境

标签: python linux visual-studio-code terminal ubuntu-18.04


【解决方案1】:

通过调用找出您的终端中使用的python解释器:

which python

(或python3,如果您使用的是 Python 3)

在 VS Code 中,按 Ctrl+Shift+P 调出命令面板并运行命令Python: Select Interpreter

从第一个命令的输出中选择一个。终端和 VS Code 现在应该使用相同的环境了。

【讨论】:

    猜你喜欢
    • 2021-01-16
    • 2020-11-01
    • 2021-07-27
    • 2013-08-28
    • 2016-01-30
    • 2018-12-30
    • 2020-05-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多