0

so I have Python 2.7.10 and I am trying to run a python script. However, I get ImportError: No module named requests. I tried pip install requests, but I got the error -bash: pip: command not found because I had removed pip because it was for python 3.5 earlier and I want it for 2.7.

However, for some reason I can't install pip. When I do sudo easy_install pip, I get the following:

Searching for pip Best match: pip 9.0.1 pip 9.0.1 is already the active version in easy-install.pth Installing pip script to /usr/local/bin error: [Errno 2] No such file or directory: 'usr/local/bin/pip'

Is there another way for me to be able to install pip?

Alan Kavanagh
  • 9,425
  • 7
  • 41
  • 65
TWeng
  • 1
  • 2
    Try installing pip by this script: https://bootstrap.pypa.io/get-pip.py – Thanh Nguyen Jan 06 '18 at 09:15
  • possible duplicate of https://stackoverflow.com/questions/9797277/how-to-install-pip-in-a-new-python-installation – itsrajon Jan 06 '18 at 09:21
  • 2
    Also, you never need to manually remove pip (for the future). You can always prefix the pip you want with `python -m pip` (or use whatever Python interpreter you want), rather than just `pip`. – Alex Huszagh Jan 06 '18 at 09:23
  • Removing system files is a complete disaster. Maybe your best way forward is to restore from backups and start over. Python with `virtualenv` is very easy to set up for multiple Python versions and library requirements; perhaps familiarize yourself with virtual environments. – tripleee Jan 06 '18 at 10:41
  • Also, there are many situations where you cannot choose, but if you can, choosing Python 2 is the wrong choice now. – tripleee Jan 06 '18 at 10:41
  • Hey guys, thanks so much for the replies. So I ran the get-pip.py script and got `pip in /Library/Python/2.7/site-packages`. However, when I do `pip install requests` I still get `-bash: pip: command not found`. Really not sure what is going on. – TWeng Jan 06 '18 at 22:32
  • Yeah, unfortunately in this situation I think I had to use version 2 because of a certain API my group is trying to use – TWeng Jan 06 '18 at 22:33

0 Answers0