-1

I am now focusing on Data Visualization with Matplotlib, and the issue I mentioned really distracts me while practicing on Python.

There is no problem after running the code. I can get expected results. Although two files are in the same directory without any typos, Visual Studio lists the following warning all the time:

import "random_wall" could not be resolved

There was a link which opened github when I clicked the first time, but now the link is not there any more.

I upload two images to help you understand my problem visually. Thanks in advance.

Python code with its issue

see the directory of files

d1sh4
  • 1,710
  • 5
  • 21
Learner
  • 31
  • 2

1 Answers1

2

The issue is basically with your virtual environment that is set in visual studio code. Change the virtual env to the one where the package is installed and it will stop showing the import warning. You can change your virtaul env in the bottom left corner or by clicking ctrl+shift+P and search for interpreter which will show you a drop down of the available interpreter in the system.

buddemat
  • 4,552
  • 14
  • 29
  • 49
  • I searched "Python: Select Interpreter" in Command Palette and saw only one available interpreter which I am now using. The other was called Default Python Interpreter Path. I tried to click the Default version, but it couldn't be set. Now the problem remains the same. – Learner Aug 24 '21 at 11:05
  • hi there, sorry for the late reply, are u using a virtual enviorment or are u using python default settings? – max the computer science fox Aug 25 '21 at 09:12
  • i do not think the problem is with the virtual environment, as the problem is when @Learner importing a file and not a framework from the venv – max the computer science fox Aug 25 '21 at 09:18
  • I think I don't have a virtual environment if Magic Python I am using is not venv. – Learner Aug 25 '21 at 12:27
  • well like i said, your original problem wasn't with the interpreter but the syntax of the file u were importing, now u can just revert everything back to normal and use the right syntax – max the computer science fox Aug 28 '21 at 01:10