Install and configure Python 3.9.9 and VS Code on Raspberry Pi

preview_player
Показать описание
Hello, and welcome to my channel!
Today I'm working through the install of Python 3.9.9 and VS Code on a Raspberry Pi 4.

The audio is a bit low on this one, as my editing skills improve hopefully this will be less of a factor.

As promised, here's the command I copied/pasted to get this all working:

Update Raspbian and install pre-reqs:
$ sudo apt-get update
$ sudo apt-get install python3-venv make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

Block updates to system-provided python:
$ for i in `dpkg --get-selections | grep python3`; do sudo apt-mark hold `echo $i|cut -f1| grep python`; done

Update the venv prompt with fun colors:
$ sed -i 's/PS1\=\"(/PS1\=\"\\[\\033\[01\;33m\\\](venv\-/gi' python/bin/activate
Рекомендации по теме
Комментарии
Автор

Coming from Paul's tutorial:
I have following error when I type in terminal as in this lecture /from vpython import */

PS python
Python 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>> from vpython import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'vpython'
>>>

mkhatri
Автор

I have two issue if possible can you make the video on this?. One when I write quit() in terminal. And second one the interpreter(selected the right one + also installed python from extenson) doesn't appear in the bottom left corner of VScode.

>>> import serial
>>> from vpython import *
>>> quit()
exit
Exception ignored in atexit callback: <function Exit at 0x000012345600>
Traceback (most recent call last):
File line 22, in Exit
a = 1.0/zero
ZeroDivisionError: float division by zero
(pyArd) PS

mkhatri
Автор

Actually the Pi OS was renamed quite a long time ago. It is no longer Raspian, it is now Raspberry Pi OS.

danman
welcome to shbcf.ru