petercli
petercli

Reputation: 693

how to fix install of requests library?

I am learning Python, using Windows and Vs Code editor. My .py simply contains : import requests and I see this error ModuleNotFoundError: No module named 'requests' I think the library is installed because : Pip freeze shows : requests==2.22.0 pip install requests shows : Requirement already satisfied: requests in d:\python\lib\site-packages (2.22.0)

What am I missing? Thanks,Peter

Upvotes: 0

Views: 607

Answers (1)

sedavidw
sedavidw

Reputation: 11691

It's likely you're using a python version that it's in a different location, do you have multiple versions of Python installed?

One easy way to see what packages you're using on that version of python is to do

>>> import site
>>> site.getsitepackages()

It's generally a good idea to use virtual environments for Python to help with that kind of package control

Upvotes: 1

Related Questions