I started learning what Python is and there was a question with the requests module. I have a MacOS. I installed the module

sudo pip install requests 

But now, when I try to run a program with an imported module without sudo, I get an error

 ImportError: No module named requests 

what am I doing wrong?

  • four
    Is the python exactly one in the system? - gil9red
  • @ gil9red unconditionally - StereoFlo
  • one
    still try pip3 instead of pip. Check does not hurt. - xxclojure
  • I think it is better to install Anaconda and not to change the system Python - it is easy to break it, and it is not always so easy to fix it - MaxU
  • what happens if you run python -mrequests.certs before / after python -mpip install requests with / without --user with / without sudo . - jfs

2 answers 2

@StereoFlo: the problem turned out to be that I used python from the MAMP assembly. In turn, system python was globally launched under sudo. I have no mistakes

    if python3: then try pip3 install requests