Python Forum
under VS Code: the terminal does not recognize "1+1" as a command
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
under VS Code: the terminal does not recognize "1+1" as a command
#1
I am a complete beginner to Python but have used VS Code quite a bit with other languages.
I am also new to Linux; the VS-Code is installed under Zorin Linux.

After installing VS Code and selecting the interpreter (using Ctrl+Shift+P) I can run a simple .py file without a problem but the terminal does not recognize "1+1" as a command.
It seems I cannot paste a screen-shot here.


On entering 1+1, the error is "Command not found".
What is missing?
   


Thanks in advance.
Reply
#2
You are not running python in the terminal, so anything you type is interpreted as a shell command. If you want to interactively execute commands in the python interpreter, you need to start the interpreter first.
Output:
E>python Python 3.13.5 (tags/v3.13.5:6cb20a2, Jun 11 2025, 16:15:46) [MSC v.1943 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. Ctrl click to launch VS Code Native REPL >>> 1 + 1 2 >>>
On Ubuntu I think you use python3 instead of python.
I strongly advise creating a virtual environment for your python exploration. This protects against messing up your system python when you install python packages.

https://linuxcapable.com/how-to-create-a...ntu-linux/
Reply
#3
Thank you.
That works (Python3).

I was watching a beginner youtube tutorial but that was an installation on windows, and there was no need to start the interpreter explicitly.
From what I understand there is no practical use for the CLI interpreter anyway.

I was thinking it is analogous to VBAs Immediate window (which is very useful) but it is not.
From what I read, only Pycharm provides a direct analog and VS offering is incomplete... too bad! I've already decided to go with VS.

Standard Visual Studio's Immediate Window for Python is limited to expression evaluation and often restricts variable assignment, whereas the Interactive Window provides a full shell but lacks the direct debugging context of the Immediate Window.
Reply
#4
Visual Studio and Visual Studio Code are not versions of the same tool. The two are very different.

I prefer VS Code. Some of my coworkers prefer PyCharm. A few use VS Code and PyCharm together, switching back and forth between them based the programming task at hand (coding, debugging, refactoring, testing, version control).
Reply
#5
Thanks for your help.
I downloaded pycharm (Community) and it simply would not start under Linux.
Maybe installing vscode messed up something.
So now I'm looking a Pyzo
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Returning numeral output in VS code terminal StephCreatesCode 4 218 Jan-26-2026, 03:45 PM
Last Post: DeaD_EyE
  python cant recognize PIP siubikYT 2 7,658 Jul-19-2023, 06:30 PM
Last Post: Lahearle
  Python VS Code: using print command twice but not getting output from terminal kdx264 4 3,003 Jan-16-2023, 07:38 PM
Last Post: Skaperen
  How to use a variable in linux command in python code? ilknurg 2 2,929 Mar-14-2022, 07:21 AM
Last Post: ndc85430
  Is it possible to make a program recognize how many clicks it has had on the monitor? jao 0 2,005 Feb-25-2022, 06:31 PM
Last Post: jao
  My program won't recognize the filename. braingoblins 1 2,177 Jan-07-2022, 06:18 PM
Last Post: deanhystad
  Using print command to send command to rasberry pi terminal MondazeBear 2 3,179 Aug-02-2021, 03:15 PM
Last Post: Larz60+
Star NameError – function doesn't recognize imported modules Sir 4 8,402 Dec-01-2020, 06:36 AM
Last Post: Sir
  Help with isinstance command (very simple code) Laplace12 2 3,346 Jul-30-2020, 05:26 AM
Last Post: Laplace12
  How do you take terminal inputs w/o halting running code? Bhoot 3 4,366 Apr-17-2020, 08:31 AM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020