![run python in visual studio code on linux run python in visual studio code on linux](https://ardupilot.org/dev/_images/VSCode-attach1.png)
- #Run python in visual studio code on linux how to
- #Run python in visual studio code on linux install
So let's install ptvsd both on the Pi and on the DEV machine. Now that we can SSH onto the Pi we need to setup the dependencies for remote debugging.
![run python in visual studio code on linux run python in visual studio code on linux](https://i.ytimg.com/vi/GYE1v8N60xg/maxresdefault.jpg)
ssh should get a command prompt on the Raspberry Pi. Replace the IP with your Pi's IP address. On your DEV machine test out the connection.
![run python in visual studio code on linux run python in visual studio code on linux](https://files.realpython.com/media/vscode-welcome-screen.c64afd719b3e.png)
#Run python in visual studio code on linux how to
Consult your router manual on how to do that. You may also want to give a static IP to it so you don't have to change the configuration we'll make further down after every reboot. Copy the content of id_rsa.pub from your DEV machine into the authorized_keys file. Inside there should be a file called authorized_keys. If the directory doesn't exist create it. On your Pi go to Raspberry Pi Configuration and make sure under Interfaces that SSH is enabled. Now that we have the keys we need to copy the public key ( id_rsa.pub) onto your Raspberry Pi. The command will generate two files, typically under /Users/yourname/.ssh/id_rsa* And there won't be any security issues as long as you keep the private key safe. When prompted for a passphrase hit Enter again. When prompted for the file in which to save the key just hit Enter to use the default path. On your DEV machine open a command prompt or terminal and run: ssh-keygen To do this we need to generate an SSH key pair. The first thing we need to do is setup SSH public key authentication because as part of the remote execution we need to copy the python scripts onto the Pi and we don't want to be prompted for the password every single time or have the password written in some config file. Setup SSH public key authentication between the Pi and the dev machine Setup SSH public key authentication between the Pi and the dev machineġ.There are 3 main steps we need to complete: a fully setup Raspberry Pi that's connected to the same network as the dev machine.Comes preinstalled on Windows 10 and most Linux distros. Should work on MacOS too but I don't have one to try. I use a Windows 10 desktop computer but can be any Linux/Windows laptop/desktop. To complete this guide you need the following: And what if you want to use Visual Studio Code? Good luck with that.įortunately there is a way to do development on your dedicated machine in Visual Studio Code and run that code remotely on the Pi with debugging capabilities, and all of that with just one click. What's not so awesome is the experience of writing code on it, especially on the Pi Zero. Raspberry Pi is an awesome little computer.