Trying to install new packages via pip on Windows, but after it installs - Python cannot resolve the import. For Example, I have just installed the Python package similaritymeasures and pip correctly installed it, but when I import it into my Python program, it cannot find the import. Has anyone know a way around this?
-
2Have you restarted VSCode? This sometimes helps...PrinsEdje80– PrinsEdje802022-02-22 13:02:29 +00:00Commented Feb 22, 2022 at 13:02
-
1Are you using the same python executable for installing and running? You might have 2 different versions of python.Adid– Adid2022-02-22 13:03:52 +00:00Commented Feb 22, 2022 at 13:03
-
restarting VS code after installing the packages with pip on cmd worked for me!Yoav24– Yoav242023-01-30 18:01:33 +00:00Commented Jan 30, 2023 at 18:01
1 Answer
Make sure that you restart VSCode after downloading your package. Sometimes, when you download a package while VSCode is still running, it doesn't recognize the package when using import similaritymeasures.
If that didn't work, then make sure that VSCode is using your preferred version of python. It is possible that you have more than one python version and it's using a non-compatible one to run your code. This can be done at the bottom right corner of the window by clicking the box that says: (for example) 3.9.5 64-bit. Then select a different (preferably older) version from the pop up widnow.
These are the solutions that came to my mind, I hope this helped.