Hao S
Hao S

Reputation: 325

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) int : The term 'int' is not recognized as the name of a cmdlet, function, script file, or operable program. 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

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. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : ReservedKeywordNotAllowed

Although running this from the editor seems to be fine.

Upvotes: 1

Views: 1974

Answers (1)

isopach
isopach

Reputation: 1938

It seems that you're using the Python extension for VSCode.

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:

Python VSC

Upvotes: 1

Related Questions