Python 为什么可以';我的代码不能在Visual Studio代码中运行吗?

Python 为什么可以';我的代码不能在Visual Studio代码中运行吗?,python,Python,我无法在Visual Studio代码中运行我的代码。当我键入$code hello.py时,会发生以下情况: 在您使用的图像中code hello.py。您应该改用python hello.py。只有在安装Python软件时选中了“将Python添加到路径”时,才能在命令提示符下运行 如果您在Mac电脑上 在Mac中,会自动安装Python 2.7。如果您想使用Python 3,那么您必须从Python官方网站手动安装,并使用python3 hello.py来使用Python 3。请记住,将使

我无法在Visual Studio代码中运行我的代码。当我键入
$code hello.py
时,会发生以下情况:


在您使用的图像中
code hello.py
。您应该改用
python hello.py
。只有在安装Python软件时选中了“将Python添加到路径”时,才能在命令提示符下运行

如果您在Mac电脑上


在Mac中,会自动安装Python 2.7。如果您想使用Python 3,那么您必须从Python官方网站手动安装,并使用
python3 hello.py
来使用Python 3。

请记住,将使用以下命令运行Python文件:
pythonyourfile\u name.py

在图像中,您正试图使用以下命令运行Python文件:
code hello.py


不要使用
code hello.py
,而是尝试使用
python hello.py

使用
python hello.py
而不要使用
code hello.py
。请考虑检查我的答案以获得更多的信息,欢迎到StAccess,点击你最喜欢的答案旁边的记号,把它标记为你的答案。这个答案在你回答之前8分钟的答案中加了什么?