Python pip installation on Mac is not working

32,427

Solution 1

Look at the final warning, which says that these scripts are not in PATH. Open Finder, and copy the listed files into the following directory: /usr/local/bin/

Go to /Users/arnau/Library/Python/2.7/bin. Duplicate the files listed into /usr/local/bin/ so that the command-line can recognize your command, pip.

If you don’t want to do this (which I don’t suggest), you can simply use the other answers for now which say to use python -m pip, which directs the command-line to the current directory of these files, /Users/arnau/Library/Python/2.7/bin. You may, however run into problems in the future doing this, so I suggested my above answer.

I also expect that you won’t want to type an additional 2 keywords every time you have to install a package.

Solution 2

Try below

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

Solution 3

Try this

sudo easy_install pip  

Then

pip install beautifulsoup4

If it doesn't work try this:

python -m pip install beautifulsoup4
Share:
32,427
Arnold Gee
Author by

Arnold Gee

Minimalism, productivity, and happy coding!

Updated on April 03, 2022

Comments

  • Arnold Gee
    Arnold Gee about 2 years

    I have a Macbook Air and want to install pip. I have the updated python version. I follow all the instructions but I cannot install any packages.

    I have been researching for more than 1 hour and looking at many articles and questions but I cannot figure it out.

    This is what is displayed on my Terminal when I try to install pip, and then install a package called beautifulsoup:

    arnau@MacBook-Air-de-Arnau ~ % python --version
    Python 2.7.16
    arnau@MacBook-Air-de-Arnau ~ % curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 1840k  100 1840k    0     0   320k      0  0:00:05  0:00:05 --:--:--  439k
    arnau@MacBook-Air-de-Arnau ~ % python get-pip.py
    DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
    Defaulting to user installation because normal site-packages is not writeable
    Collecting pip
      Using cached pip-20.2.2-py2.py3-none-any.whl (1.5 MB)
    Installing collected packages: pip
      Attempting uninstall: pip
        Found existing installation: pip 20.2.2
        Uninstalling pip-20.2.2:
          Successfully uninstalled pip-20.2.2
      WARNING: The scripts pip, pip2 and pip2.7 are installed in '/Users/arnau/Library/Python/2.7/bin' which is not on PATH.
      Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
      NOTE: The current PATH contains path(s) starting with `~`, which may not be expanded by all applications.
    Successfully installed pip-20.2.2
    arnau@MacBook-Air-de-Arnau ~ % pip install beautifulsoup4
    zsh: command not found: pip
    arnau@MacBook-Air-de-Arnau ~ % 
    

    I don't understand what is happening or what I should do to solve the error.

  • Arnold Gee
    Arnold Gee over 3 years
    it works! But why do I have to write python -m before pip install beautifulsoup4? What does the -m mean?
  • Baban Gain
    Baban Gain over 3 years
    '''pip install beautifulsoup4''' doesn't work because pip is not configured properly. python -m does many things. Check it here stackoverflow.com/questions/7610001/…
  • Arnold Gee
    Arnold Gee over 3 years
    I did it and it works. Thanks, I didn't understand what "PATH" means. python -m pip also works.
  • Ryan Rudes
    Ryan Rudes over 3 years
    Ok, that’s great!
  • Arnold Gee
    Arnold Gee over 3 years
    Thanks for the link. I will sure read it whole. I am new to python (3 days in) and still have a lot to learn.
  • pir800
    pir800 almost 3 years
    for me, running 'python3 -m pip' is what worked
  • Spence_p
    Spence_p over 2 years
    I looked for a day and a half for this answer. I think I screwed something up becuase I was downloading into my icloud drive? Do you know if that can impact development?
  • Jacob K
    Jacob K over 2 years
    Could use code formatting