Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ubuntu 18.04上的VSCode无法运行Python程序_Python_Visual Studio Code - Fatal编程技术网

Ubuntu 18.04上的VSCode无法运行Python程序

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

我试图在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/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。