简体   繁体   English

Visual Studio 代码(在终端中运行 Python 文件不起作用)

[英]visual studio code (run Python file in terminal does not work)

visual studio code,视觉工作室代码, 截屏 pressing run does not work on mac.按下运行在 mac 上不起作用。 Let say I want to print the word "Hello" and run the code print("Hello"), it will not be executed.假设我想打印单词“Hello”并运行代码 print("Hello"),它不会被执行。 I tried reinstalling python and visual studio but I could't resolve the problem.我尝试重新安装 python 和 Visual Studio,但我无法解决问题。

I ran into the same issue.我遇到了同样的问题。 Figured out that I forgot to select the Add Python 3.8 to PATH while installing.发现我忘了 select 安装时将 Python 3.8 添加到 PATH中。 You can either choose to uninstall and reinstall Python and make sure to select the above option OR you can manually update the user environment variable for PATH and add the path to scripts and python like the following.您可以选择卸载并重新安装 Python 并确保 select 上述选项,或者您可以手动更新 PATH 的用户环境变量并将路径添加到脚本和 Z23EEEB4347BDD26BZFC6B7EE9A3B755DD6B7EE9A3B755DD,如下所示。

C:\Users\<addyourusernamehere>\AppData\Local\Programs\Python\Python38-32\Scripts\
C:\Users\<addyourusernamehere>\AppData\Local\Programs\Python\Python38-32\

When this happens to me, the Python interpreter borked and I need to press ctrl + c (abort) in the terminal a couple of times.当这种情况发生在我身上时,Python 解释器出现故障,我需要在终端中按ctrl + c (中止)几次。 It's still in the Python process and vscode is trying to input the run command into a Python process that's not actually a terminal.它仍在 Python 进程中,vscode 正在尝试将运行命令输入到 Python 进程中,该进程实际上不是终端。

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

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