pip install worked, but import still says ModuleNotFoundError
Ran pip install requests, it said "Successfully installed". Then import requests in my script → ModuleNotFoundError. What am I missing?
Ran pip install requests, it said "Successfully installed". Then import requests in my script → ModuleNotFoundError. What am I missing?
Comments 5
Join the discussion CommentAlready have an account? Log in
Classic. You probably have two Pythons and pip installed into a different one than the one running your script.
Use the same interpreter for both:
python -m pipguarantees the package goes into the Python you're actually running. On Windowspy -m pipdoes the same.That was it.
pippointed to an old 3.9 install,pythonwas 3.13.Also check which interpreter your editor uses. VS Code shows it in the bottom right corner, and it's often not the one you think.
And once you have more than one project, use a virtual environment for each. Saves a lot of these headaches.