Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
680 views
in Technique[技术] by (71.8m points)

macos - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Try below

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...