1

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?

3
  • 2
    Have you restarted VSCode? This sometimes helps... Commented Feb 22, 2022 at 13:02
  • 1
    Are you using the same python executable for installing and running? You might have 2 different versions of python. Commented Feb 22, 2022 at 13:03
  • restarting VS code after installing the packages with pip on cmd worked for me! Commented Jan 30, 2023 at 18:01

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Your answer could be improved with additional supporting information like 'how to check which Python Version is used by VSCode'. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.