where and how to run Python code from within VSCode?

Need help with C, C++, perl, python, etc?

where and how to run Python code from within VSCode?

Postby say_hello » 2020-03-16 16:10

dear community,

I just installed VSCode (https://code.visualstudio.com/) on the notebook.

I like the look of it and like its tools and features. (note i runned ATOM for some months now and PyCharm for allmost one year)
I am impressed by the set of features VSCode offered, so I figured I would give it a go.

I just downloaded installed the application and fired it up, messed around a bit with some of the cool features

but wait: after playing around - then realized I had no idea how to actually execute any of my Python code!
I really like the look and feel/usability/features of VSCode, but I can't seem to find out how and where to run my Python code,

Does anyone know if there is a way to execute Python code in VSCode?

Note: ATOM is not eays too - but with the right setup youre able to go ahead...


btw: i love the features in VSCode..

Git commands built-in.
Working with Git and other SCM providers has never been easier. Review diffs, stage files, and make commits right from the editor. Push and pull from any hosted SCM service.

Extensible and customizable.
Want even more features? Install extensions to add new languages, themes, debuggers, and to connect to additional services. Extensions run in separate processes, ensuring they won't slow down your editor. Learn more about extensions.
User avatar
Posts: 26
Joined: 2019-10-13 09:58

Re: where and how to run Python code from within VSCode?

Postby say_hello » 2020-03-18 09:06

the question is just like so: VSCode :: ATOM :: PyCharm or Anaconda which one to take!?

dear community , i am on Linux MX 19.1 which is a Debian-based type of Linux. i want to set up a Python development environment:

i have several options: [/b ]we can use Flatpack, since it is integrated into MXPI and it makes easier. some of my friends not use this (Fedora) packaging system, i can install codium as sugested on their web page: it is supposed to worked and we re keep getting updates if we install codium.

Here are the steps we can use: (Codium is the same as Code, just removed Microsoft 'telemetry')
VSCodium: https://github.com/VSCodium/vscodium/releases

# Add the GPG key of the repository:
Code: Select all
wget -qO - https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg | sudo apt-key add -

# Add the repository:

echo 'deb https://gitlab.com/paulcarroty/vscodium ... epos/debs/ vscodium main' | sudo tee --append /etc/apt/sources.list.d/vscodium.list

# Update then install vscodium:

Code: Select all
sudo apt update && sudo apt install codium

: Btw, there is another option - Anaconda. If we install Anaconda, huge scientific package, many research labs use it,
it comes with VS Code (well during installation we need to confirm that we want VS Code also installed) and then VSCode becomes integrated with it. Plus we furthermore get another IDE, simpler Spyder, plus Jypiter Notebook which I really like for certain things. We can check out Anaconda also. Although it is damned huge, some 12GB and after we start creating virtual environments in it, it will get even damned-bigger. Ah, yes, it is perfect for managing virtual environments, we can create them with mouse click, choose what version of python to use with it, which packages... all with mouse if we prefer GUI. Lots of choices...

Well we do have to discuss ATOM too and Pycharm lots and lots of choices. Which one to take?
i love to hear from you


note: i currently work on two systems - on a MX-Linux and a Win10 machine:

and now i have to tell you i have PyCharm and ATOM on my Win10 machine:

i just updated PyCharm -

Question: can ATOM work with the Python 3.7 which PYCharm notes in the console. in other words - is Atom able to work
:\Users\Kasper\PycharmProjects\untitled1\venv\Scri pts\python.exe "C:\Program Files\JetBrains\PyCharm Edu 2019.2\helpers\pydev\pydevconsole.py" --mode=client --port=50214
PyDev console: starting.
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32

the question is: Question: can ATOM work with the Python 3.7 which PYCharm notes in the console. in other words - is Atom able to work

and how to test pip on the machine - is it included in Python 3.7!?

cf: https://matthewhorne.me/how-to-install-python-and-pip-on-windows-10/

f the setup ran successfully, you should see a message “Setup was successful message.” Close and continue with the next steps.

Installing and Testing PIP: PIP is a package management system for Python, so you will want to install this handy tool to make your life simpler.

To install PIP first head over to “Get PIP,” you will see something like this:

Code: Select all
C:\Users\Kasper>pip -V
pip 10.0.1 from c:\program files\python37\lib\site-packages\pip (python 3.7)

i am happy - i have pip installed ...

by the way: i have some errors while trying to install bs4

Code: Select all
Installing collected packages: soupsieve, beautifulsoup4
Could not install packages due to an EnvironmentError: [WinError 5] Zugriff verweigert: 'c:\\program files\\python37\\Lib\\site-packages\\soupsieve'
Consider using the `--user` option or check the permissions.

You are using pip version 10.0.1, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

on a sidenote: Installing Visual Studio Code on Debian

cf: https://linuxize.com/post/how-to-instal ... -debian-9/

Visual Studio Code is a free and open-source cross-platform code editor developed by Microsoft. It has a built-in debugging support, embedded Git control, syntax highlighting, code completion, integrated terminal, code refactoring and snippets. Visual Studio Code functionality can be extended using extensions.

This tutorial explains how to install Visual Studio Code editor on Debian using apt from the VS Code repository.

The user you are logged in as must have sudo privileges to be able to install packages.

Complete the following steps to install Visual Studio Code on your Debian system:

Start by updating the packages index and installing the dependencies by typing:
Code: Select all
sudo apt update
sudo apt install software-properties-common apt-transport-https curl
Import the Microsoft GPG key using the following curl command:

Code: Select all
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
Add the Visual Studio Code repository to your system:
Code: Select all
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
Once the apt repository is added, install the latest version of Visual Studio Code with:

Code: Select all
sudo apt update
sudo apt install code
That’s it. Visual Studio Code has been installed on your Debian desktop and you can start using it.

Starting Visual Studio Code
Once the VS Code is installed on your Debian system you can launch it either from the command line by typing code or by clicking on the VS Code icon (Activities -> Visual Studio Code).

When you start VS Code for the first time, a window like the following will be displayed:

this i only wanted to mention
Last edited by say_hello on 2020-03-19 23:29, edited 1 time in total.
User avatar
Posts: 26
Joined: 2019-10-13 09:58

Re: where and how to run Python code from within VSCode?

Postby Head_on_a_Stick » 2020-03-18 19:05

say_hello wrote:i am on Linux MX 19.1

We don't support that here, sorry.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Posts: 13273
Joined: 2014-06-01 17:46
Location: /dev/chair

Return to Programming

Who is online

Users browsing this forum: No registered users and 4 guests