简体   繁体   English

使用 Python 的 Visual Studio 错误 Ctrl + Alt + N

[英]Visual Studio Error Ctrl + Alt + N with Python

I'm new to coding and just started using Visual Studio to learn Python.我是编码新手,刚开始使用 Visual Studio 学习 Python。 In a tutorial video, the professor said that I can hit Ctrl + Alt + N to automatically run my code.在教程视频中,教授说我可以按 Ctrl + Alt + N 自动运行我的代码。 I get the error "[Running] python -u "c:\\Users***\\Desktop\\Test\\app.py" 'python' is not recognized as an internal or external command, operable program or batch file."我收到错误“[Running] python -u "c:\\Users***\\Desktop\\Test\\app.py" 'python' 未被识别为内部或外部命令、可运行的程序或批处理文件。” I am able to run it when I go to my terminal and run through CMD but not when I do the shortcut.当我进入终端并通过 CMD 运行时,我可以运行它,但当我执行快捷方式时则不能。 I looked through settings and there wasn't anything I saw that stood out.我查看了设置,没有看到任何突出的东西。 Any suggestions?有什么建议?

Thanks谢谢

  1. Open the Start Search, type in “env”, and choose “Edit the system environment variables”:打开开始搜索,输入“env”,然后选择“编辑系统环境变量”:

  2. Click the “Environment Variables…” button单击“环境变量...”按钮

  3. Click on Path variable单击路径变量

  4. Click on edit button点击编辑按钮

  5. Create a new address, where you have installed python.创建一个新地址,在那里你已经安装了python。 The default address is C:\\Python34默认地址为C:\\Python34

  6. Save and exit the window保存并退出窗口

  7. Install Python extension on VScode在 VScode 上安装 Python 扩展

  8. Restart VScode重启VScode

  9. If the problem continues, open command palette ( CTRL + Shift + p )如果问题仍然存在,请打开命令面板 (CTRL + Shift + p)

    9.1. 9.1. Type Python键入 Python

    9.2. 9.2. Select python interpreter from the drop down menu从下拉菜单中选择python解释器

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

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