0

when I am trying to import "requests" in python it shows me ModuleNotFoundError No module named 'requests' error but i have already installed it.

[+] pip list

[out] requests 2.31.0

i also have two users on system, may it create confusion? i am using win 11 thanks

tried: pip list, checking for env, uninstall, pip show requests, python --version, chatgpt

  • 2
    You probably have more than one Python environment installed on your machine – DarkKnight Jul 06 '23 at 18:14
  • 1
    You can use [which command](https://phoenixnap.com/kb/which-command-linux) in Linux or [where command](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/where) in Windows to find which pip you are using. Just use `which pip` or `where pip` to find out location of your pip executable. It should match the location of your Python installation for the version that you are using. Also if you are using Python or Anaconda environments that take a look at this [question](https://stackoverflow.com/questions/50762627). – ands Jul 06 '23 at 18:59
  • This is why it's recommended to use `pip` like this: ` -m pip`, where `` is the executable you use to run your code. – Michael Ruth Jul 06 '23 at 22:06
  • is the module you are using to test requests named requests.py? This way, [the name would get shaded](http://python-notes.curiousefficiency.org/en/latest/python_concepts/import_traps.html#the-name-shadowing-trap) and hence lead to an import error. – Christian Karcher Jul 07 '23 at 08:05

0 Answers0