简体   繁体   English

无法在 VScode mac 上运行 python 脚本

[英]Can't run a python script on VScode mac

just getting into programming for uni, can't seems to setup VScode for python.刚开始为 uni 编程,似乎无法为 python 设置 VScode。 When running a script I get this message: /bin/sh: python: command not found I read about smth similar all around the internet, I am sure python is installed.运行脚本时,我收到以下消息: /bin/sh: python: command not found 我在互联网上读到了类似的东西,我确定 python 已安装。 To check, in the terminal I write "type python" and get the message displayed saying: python is an alias for /usr/bin/python3 Just don't know what to do, thank you for your answer:)要检查,在终端中我写“type python”并显示消息:python is an alias for /usr/bin/python3 只是不知道该怎么做,谢谢你的回答:)

Try python3 --version in your terminal.在您的终端中尝试python3 --version

  1. If you can get the information about python, this means python is installed successfully .如果能得到 python 的信息,说明 python 安装成功
  2. Then you need to create a workspace in vscode.然后你需要在 vscode 中创建一个工作区 And use shortcuts "Ctrl+shift+P" then type "Python: Select interpreter" to choose your python interpreter.并使用快捷键“Ctrl+shift+P” ,然后键入“Python: Select 解释器”来选择您的 python 解释器。
  3. After writing your code, click the icon in the picture to run the code:编写好代码后,点击图片中的图标运行代码:

在此处输入图像描述

or use command python3 hello.py .或使用命令python3 hello.py (macOS/Linux) (macOS/Linux)

You can refer to the docs for more details.您可以参考文档以获取更多详细信息。

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

相关问题 在Mac上使用VSCode,无法运行Python 3.8,只能运行Python 2.7.16 - Using VSCode on Mac, can't get Python 3.8 to run, only Python 2.7.16 无法在 VScode 中运行脚本(模块错误) - Can't run script in VScode (module error) 无法从 python 脚本运行 brownie 并且无法运行控制台(Windows VSCode) - Unable to run brownie from python script and can't run console (Windows VSCode) 无法运行python脚本 - Can't run a python script 如何使用脚本的相同路径在 VSCode 中运行 Python 脚本? (否则它找不到位于同一文件夹中的输入文件) - How to run a Python script in VSCode using the same path of the script? (otherwise it can't find an input file located in the same folder) 无法在 VSCode 中运行 Jupyter Notebook - Vanilla Python、Windows 10 - Can't run Jupyter Notebook in VSCode - Vanilla Python, Windows 10 编辑设置后无法在VScode中运行python。json - Can't run python in VScode after editing settings.json 我无法在 vscode 中运行代码或调试我的 python 文件 - I can't run code or debug of my python file in vscode python3不会从mac shell脚本运行 - python3 won't run from mac shell script 为什么我的python脚本不能作为Mac应用程序运行? - Why doesn't my python script run as a Mac app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM