vscode python没有输出

时间:2020-07-25 04:21:47

标签: python visual-studio-code

print("hello")

无论我在python文件中写什么,它都只提供当前文件路径。我该如何解决?

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
Gangs-MacBook-Pro:yashirq gangzhao$ /usr/bin/python3 /Users/gangzhao/yashirq/Practice/Python/Grokking_Algorithms/Binary_Search.py

enter image description here

3 个答案:

答案 0 :(得分:0)

您如何运行文件?通常,您必须设置一个environment。如果您只想运行一个python文件并在集成终端中查看输出,请尝试右键单击编辑器,然后单击Run Python File in Terminal

答案 1 :(得分:0)

我刚刚在VS Code中运行了该程序,效果很好。

只需右键单击并选择“在终端中运行Python文件”选项。应该可以!

Run Python file in terminal

Sample Code

答案 2 :(得分:0)

检查terminal.integrated.inheritEnv设置。我在ubuntu上,并将其设置为false / unchecked。切换为true / checked可以恢复终端功能。