Skip to content
Permalink
Browse files

Add some notes on creating a .venv for code completion

  • Loading branch information...
dlech committed Feb 1, 2019
1 parent 642a333 commit bfd0d8884cbd418d586a25161ca83c23126e6301
Showing with 29 additions and 3 deletions.
  1. BIN .README/vscode-python-select-interpreter.png
  2. +29 −3 README.md
Binary file not shown.
@@ -75,10 +75,36 @@ ev3dev in Visual Studio Code using the Python programming language.
18. Open the source code file, `hello.py`, to learn more.


## TODO
## Code Completion

To get code completion working and fix errors like "Unable to import 'ev3dev2.motor'"
you will need to install Python and the `python-ev3dev` package on your computer.

1. If you don't already have Python installed, get it from https://python.org
or your favorite package manager (Chocolaty, Homebrew, Apt, etc.).

2. Then set up a virtual environment. You can type these commands on the
built-in terminal in VS Code.

On Windows (make sure you are using CMD, not PowerShell):

py -3 -m venv .venv
.venv\Scripts\activate
python -m pip install --upgrade pip
pip install python-ev3dev2

Or non-Windows:

python3 -m venv .venv
. .venv/bin/activate
pip install --upgrade pip
pip install python-ev3dev2

3. In the VS Code command pallete, run the `Python: Select Interpreter` command
to select the `.venv` folder that you just created.

![screenshot](.README/vscode-python-select-interpreter.png)

* Explain how to get code completion working
* Explain how to install ev3dev-lang-python on the host computer

[ev3dev]: http://www.ev3dev.org
[code]: https://code.visualstudio.com/

2 comments on commit bfd0d88

@lazenbyace

This comment has been minimized.

Copy link

lazenbyace replied Feb 18, 2019

Hello. We have followed all of the instructions and are still getting the ModuleNotFoundError for ev3dev2. I've been working with my robotic's team for a week trying to resolve this issue. We have the latest stretch image on our SD cards, are using VS Code and successfully running non ev3dev programs on the brick. We have installed python-ev3dev2 on our PCs and also created the virtual environment. I would really appreciate any suggestions you have. Thank you.

@dlech

This comment has been minimized.

Copy link
Member Author

dlech replied Feb 18, 2019

Could you please open an issue at https://github.com/ev3dev/ev3dev/issues for this and include the exact steps to repeat the problem? This is working for me on Windows, Linux and Mac so we need to find out what you are doing differently.

Please sign in to comment.
You can’t perform that action at this time.