Pylance don't work in my root folder, but work in other folder. Why did this happen?

139 Views Asked by At

I use VSCode write my code in remote Linux Server with Python and Pylance extensions. but the Pylance don't work in my root folder, like this:

Pylance don't work, the color of import module don't change

X

However, when i change my workspace folder, it works, like this:

Pylance can work, the color of import module changed and it recognized 'cv2' module didn't import X

I want to know why it happened and how to fix it.

1

There are 1 best solutions below

0
On
  1. Check Python Interpreter: Make sure you have selected the correct Python interpreter for your workspace. You can do this by using shortcuts Ctrl+Shift+P and type Python: Select Interpreter to choose your python interpter.
  2. Check User Settings: Open your user settings by going to File > Preferences > Settings and make sure the Python › Analysis: Enabled setting is checked.

If you're still facing issues after trying these steps, it might be a bug in the Pylance extension. In that case, you might want to report the issue on the Pylance GitHub repository.