Arnold Gee
Arnold Gee

Reputation: 906

Python pip installation on Mac is not working

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.

Upvotes: 5

Views: 62127

Answers (7)

sameer
sameer

Reputation: 443

Try checking this link, and Please enter the shown command(similar to python -m ensurepip --upgrade) in the terminal. After successful complication make sure to check using the command pip3 --version in terminal to check if the installation was successful or not

Upvotes: 0

Jay Prakash Sharma
Jay Prakash Sharma

Reputation: 1

type in "install pip3" in the terminal

Upvotes: 0

Aishiteru
Aishiteru

Reputation: 1

If neither of the above options work try :

sudo easy_install pip

Then :

python get-pip.py

This worked for me cause I kept getting errors

Upvotes: 0

jzet
jzet

Reputation: 319

Try below

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

Upvotes: 6

Valentin Stamate
Valentin Stamate

Reputation: 1439

Install it form here: https://www.python.org/downloads and check "Add to PATH".. . It comes with pip installed

Upvotes: 0

user192361237
user192361237

Reputation: 548

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.

Upvotes: 9

Baban Gain
Baban Gain

Reputation: 654

Try this

sudo easy_install pip  

Then

pip install beautifulsoup4

If it doesn't work try this:

python -m pip install beautifulsoup4

Upvotes: 3

Related Questions