12

I followed online instructions on how to install pip on macOS (for example this, this, and this).

I all seems to simple, but it's not working for me.

My python --version is 2.7.10.

When I run sudo easy_install pip I get:

$ sudo easy_install pip
Password:
Searching for pip
Reading http://pypi.python.org/simple/pip/
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for pip
error: Could not find suitable distribution for Requirement.parse('pip')

Any idea how I can fix or work around this?

meaning-matters
  • 21,929
  • 10
  • 82
  • 142
  • 2
    `sudo` and `pip` in the same command seem like a bad idea on OSX. I'd rather keep the system-provided Python completely under the OS updater control, and would do _any_ development and pip-based installation in a `virtualenv` and/or on a brew-installed Python. – 9000 Dec 27 '17 at 18:55
  • @9000 Thanks for the advice. I'm new to Python. I did install brew during my attempts. How do I keep things under brew? – meaning-matters Dec 27 '17 at 18:59
  • 1
    Just use `pip install` instead of `sudo pip install`. When in doubt, use `/usr/bin/pip`. Better yet, `brew install virtualenv`, [create a separate environment](https://virtualenv.pypa.io/en/stable/userguide/) for each project, and install project-specific dependencies. This way projects never conflict with each other. – 9000 Dec 27 '17 at 19:50

3 Answers3

15

You might have pip3 instead. Use it to upgrade pip.

pip3 install --upgrade pip
Phillip Havea
  • 243
  • 2
  • 7
6

Use brew for Macs

brew install python

this will come with pip and both python2 and python3

instructions to bypass 2 python versions (if you want) are at https://pip.readthedocs.io/en/stable/installing/

otherwise, it'll just be "python3 <'program'>"

Here's how to install brew: https://www.howtogeek.com/211541/homebrew-for-os-x-easily-installs-desktop-apps-and-terminal-utilities/

Mo.
  • 26,306
  • 36
  • 159
  • 225
Donovan Jenkins
  • 133
  • 1
  • 13
4

easy_install has been deprecated. Use below commands instead.

  1. curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

  2. python get-pip.py

Source

akshaynagpal
  • 2,965
  • 30
  • 32