If I do pip3 install requests (Requirement already satisfied),
If I do pip install requests (Requirement already satisfied),
python3.9 -mpip install requests (Requirement already satisfied),
It seems like I have requests already installed but still I get "ModuleNotFoundError: No module named 'requests'"
I'm having a file with this code in my django project
import requests
def client():
credentials = {"username": "admin", "password": "123456789"}
response = requests.post("http://127.0.0.1:8000/api/rest-auth/login/",
data=credentials)
print("Status Code:" , response.status_code)
response_data = response.json()
print(response_data)
if __name__ == "__main__":
client()
I found a solution at this website
Solution:
python3 -m pip install --user requests
It then got installed on python3 but not 2 or less, so it would only work if you use python3.
Depends on your default version of python. mine is Python 2.7.16