简体   繁体   English

在 VS 代码 python 终端中运行 python 的问题

[英]Trouble running python in VS code python terminal

even stuff like help(int) seems to give me error in vs code terminal for python甚至像 help(int) 这样的东西似乎在 python 的 vs 代码终端中给我错误

help(int) int : The term 'int' is not recognized as the name of a cmdlet, function, script file, or operable program. help(int) int :术语“int”不被识别为 cmdlet、函数、脚本文件或可运行程序的名称。 Check the spelling of the name, or if a path was included, verify that the path is检查名称的拼写,或者如果包含路径,请验证路径是否为
correct and try again.正确并重试。 At line:1 char:6 + help(int) + ~~~ + CategoryInfo : ObjectNotFound: (int:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException在行:1 char:6 + help(int) + ~ ~ + CategoryInfo : ObjectNotFound: (int:String) [], CommandNotFoundException +fullyQualifiedErrorId : CommandNotFoundException

Other examples:其他例子:

from dateline import date At line:1 char:1 + from dateline import date + ~~~~ The 'from' keyword is not supported in this version of the language. from dateline import date At line:1 char:1 + from dateline import date + ~~~~ 此版本的语言不支持“from”关键字。 + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : ReservedKeywordNotAllowed + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException +fullyQualifiedErrorId : ReservedKeywordNotAllowed

Although running this from the editor seems to be fine.虽然从编辑器运行它似乎没问题。

It seems that you're using the Python extension for VSCode.您似乎正在使用 VSCode 的 Python 扩展。

As it is merely an interpreter that runs on PowerShell, you will still need to prepend your command with python for it to work, such as python script.py , shown in the screenshot below:由于它只是一个在 PowerShell 上运行的解释器,您仍然需要在命令前加上python才能使其工作,例如python script.py ,如下面的屏幕截图所示:

蟒蛇VSC

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

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