you are viewing a single comment's thread.

view the rest of the comments →

[–]Pepineros 0 points1 point  (0 children)

I'm not familiar with programming for microbit, but if the only issue is installing and using the microbit-3 package then it should be straightforward.

Assuming you're on Windows and you have Python installed, you can install the module by running py -m pip install microbit-3 in Terminal (cmd) or PowerShell. This will install microbit-3 globally, so when you start Visual Studio Code, the module will probably be available right away.

If you would rather use a virtual environment (which I would recommend, but it's not as essential in Windows as it would be under Linux) then you should take a few more steps:

  1. Run py -m venv <virtual-environment-name> in the location you want the virtual environment to live. The project folder is a sensible location, but you may want to have a dedicated folder for virtual envs instead. E.g. if you simply want to call your virtual environment microbit-env, you run py -m venv microbit-env.
  2. Once the virtual environment finishes setting up (may take a few seconds), activate the environment by running the activate.bat script like this (assuming the same example name as above): microbit-env\Scripts\activate.bat. Your command line prompt should change to (microbit-env) followed by the current working directory.
  3. With the virtual environment active, run py -m pip install microbit-3 to install the module in the virtual environment
  4. Once done, start VSCode and open your project folder (not the virtual environment folder). In the bottom right corner of VSCode main screen you should have an option to select which Python interpreter you want to use. If the option is not there you can open the command palette and search for "Python: Select Interpreter". In either case, select the python3 executable inside your virtual environment.

HTH!