Calvin Lin
Calvin Lin

Reputation: 97

Missing module source

I am a beginner in python, django coding. I just receive a folder that consist of a web made out of django. After i recieve it, I use powershell and go to that folder :

pipenv shell 
pipenv install Django==3.2.5 

When i open the codes in visual studio code, I got problems: enter image description here

How do i solve this issue?

PS: Disable Pylance removes the problem. But will this affect my development of the website? Can someone kindly explain to me?

Upvotes: 1

Views: 20502

Answers (4)

Paul Prince
Paul Prince

Reputation: 1

You should make sure you have selected the right python interpreter which you have installed the packages you want to import because using the wrong interpreter might bring up such errors

Upvotes: 0

Saitama
Saitama

Reputation: 23

Sometimes just quitting and reopneing VS Code helps. I know it's weird but it works for me for these errors sometimes so give it a try.

Upvotes: 0

Leodarkseid
Leodarkseid

Reputation: 51

I solved this by simply clicking . (ctrl + ,) and then searching venv . then just click items and add the directory to were your virtual env is installed.

That pretty much cleared up all these errors for me and also I can reuse my VirtualVenv for all my django related projects

Upvotes: 2

Steven-MSFT
Steven-MSFT

Reputation: 8411

You should make sure you have selected the right python interpreter which you have installed the packages you want to import.

Such as this python interpreter created by the pipenv:

enter image description here

Or you can reinstall the packages under the python interpreter which you have selected in the VSCode.

You can refer to this page for more information about the environment in VSCode.

Upvotes: 1

Related Questions