I often use python in VScode. However, after two VScode updates, the import function (cv or numpy) is not working. I've tried using the shift command p
and > python select interpret
e but none are working for these functions.
I tried use > pip install pylint
but it didn't work.
How can I solve this problem? Has someone the same problem in VScode?
CodePudding user response:
Steps I would suggest to follow:
- install the package again (cv2), even if it is installed.
- check vs code if it has any updates for the python extension.
- update vs code application.
- restart vs code.
hope this helps.
CodePudding user response:
It is recommended to use a virtual environment to manage third-party packages and python versions more conveniently.
Create a virtual environment with the following command
python -m venv myenv
After the command is completed, select the virtual environment interpreter just created in the Select Interpreter panel
The new terminal can automatically activate the environment
Now there is no package installed in the new virtual environment, and an error occurs
Install the
cv2
package in the new environment, and the error disappeared after installing the package