Ubuntu 18.04上的VSCode无法运行Python程序
我试图在Ubuntu 18.04系统上使用VSCode和Python3.6。我写了一个hello world节目Ubuntu 18.04上的VSCode无法运行Python程序,python,visual-studio-code,Python,Visual Studio Code,我试图在Ubuntu 18.04系统上使用VSCode和Python3.6。我写了一个hello world节目 msg = "Hello World" print(msg) 如果我高亮显示它并按shift+enter,它将正常运行,但是,如果我右键单击并选择在终端中执行文件,我会收到此错误消息 >>> /usr/bin/python3.6 /home/nuria/hello/hello.py File "<stdin>", line 1 /usr/b
msg = "Hello World"
print(msg)
如果我高亮显示它并按shift+enter,它将正常运行,但是,如果我右键单击并选择在终端中执行文件,我会收到此错误消息
>>> /usr/bin/python3.6 /home/nuria/hello/hello.py
File "<stdin>", line 1
/usr/bin/python3.6 /home/nuria/hello/hello.py
^
SyntaxError: invalid syntax
>>>
我真的不知道怎么修。请帮忙 之所以发生这种情况,是因为您的终端仍在运行python。vscode试图在python终端中执行/usr/bin/python3.6/home/nuria/hello/hello.py,当您使用Shift+Enter执行代码时,该终端仍在运行。只要退出python shell,一切都会正常工作。没关系,我解决了它可能会发生的问题,因为。在python3.6中。可能确切路径仅为/use/bin/python3。