Make VS Code find module installed by Pip command on linux

Asked

Viewed 2,855 times

1

I installed matplotlib by sudo apt-get and VS Code was able to find the library automatically, however with pyserial by Pip command, VS Code cannot find, as I should do?

  • Have you installed Virtualenv (to create multiple development environments) or are you only using a single version of Python in your single main environment (linux)? Which version of Python is using? (Make sure you are connected to the current environment where you installed the lib.) You tested the call to the module? Inside Vscode, open the terminal and the Python interpreter. Once done, type serial import to test the existence of the module.

  • I didn’t install Virtualenv because I didn’t even know it was necessary, but I will check, Elementary OS already installed Python 3 and 2, I have already tested the import calls, but only the serial that fails.

  • 1

    It is not necessary to install Virtualenv no. I only ask because it usually happens when we have different python environments with different versions. Make sure you are not installing the library by referencing the old (system native) version of Python installed on your machine. Install using pip3: pip3 install pyserial .

1 answer

1


Apparently the Pip command installed relative to Python 2, so I ran the

sudo apt-get install python3-pip 

Then ran Pip specific for Python 3

pip3 install pyserial

Then VS Code recognized automatically.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.