UPDATED - Homebrew version after 1.5
According to the official Homebrew page:
On 1st March 2018 the python formula will be upgraded to Python 3.x and a python@2 formula will be added for installing Python 2.7 (although this will be keg-only so neither python nor python2 will be added to the PATH by default without a manual brew link --force). We will maintain python2, python3 and python@3 aliases.
So to install Python 3, run the following command:
brew install python3
Then, the pip or pip3 is installed automatically, and you can install any package by pip install <package>.
The older version of Homebrew
Not only brew install python3 but also brew postinstall python3
So you must run:
brew install python3
brew postinstall python3
Note that you should check the console, as it might get you errors and in that case, the pip3 is not installed.
UPDATED - Homebrew version after 1.5
According to the official Homebrew page:
On 1st March 2018 the python formula will be upgraded to Python 3.x and a python@2 formula will be added for installing Python 2.7 (although this will be keg-only so neither python nor python2 will be added to the PATH by default without a manual brew link --force). We will maintain python2, python3 and python@3 aliases.
So to install Python 3, run the following command:
brew install python3
Then, the pip or pip3 is installed automatically, and you can install any package by pip install <package>.
The older version of Homebrew
Not only brew install python3 but also brew postinstall python3
So you must run:
brew install python3
brew postinstall python3
Note that you should check the console, as it might get you errors and in that case, the pip3 is not installed.
You could use Homebrew.
Then just run:
brew install python3
How do I install Pip to Mac?
how to install pip - Apple Community
Problem with default python3 and pip3 loc… - Apple Community
macos - Why do I only have pip3 but no pip? - Ask Different
Videos
UPDATE: This is no longer necessary as of Python3.4. pip3 is installed as part of the general Python3 installation.
I ended up posting this same question on the python mailing list, and got the following answer:
# download and install setuptools
curl -O https://bootstrap.pypa.io/ez_setup.py
python3 ez_setup.py
# download and install pip
curl -O https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
Which solved my question perfectly. After adding the following for my own:
cd /usr/local/bin
ln -s ../../../Library/Frameworks/Python.framework/Versions/3.3/bin/pip pip
So that I could run pip directly, I was able to:
# use pip to install
pip install pyserial
or:
# Don't want it?
pip uninstall pyserial
I had to go through this process myself and chose a different way that I think is better in the long run.
I installed homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
then:
brew doctor
The last step gives you some warnings and errors that you have to resolve. One of those will be to download and install the Mac OS X command-line tools.
then:
brew install python3
This gave me python3 and pip3 in my path.
pieter$ which pip3 python3
/usr/local/bin/pip3
/usr/local/bin/python3
I'm brand new to Python and I'm trying to install pip to Python on my Mac. I did try to check if it was already there but the methods I used didn't work so far.
I have gone through a bunch of different tutorials but they don't work.
I've tried using what this website tells me: https://github.com/pypa/get-pip?tab=readme-ov-file
But Python keeps saying "SyntaxError" at $ and https
Can someone help me?
If you had python 2.x and then installed python3, your pip will be pointing to pip3. you can verify that by typing pip --version which would be the same as pip3 --version.
On your system, you have now pip, pip2 and pip3.
If you want you can change pip to point to pip2 instead of pip3.
you can either add the alias to your ~/.bashrc
alias pip=pip3
or add to your $PATH symlink named pip pointing to pip3 binary
MacOS comes with python version 2.7.10. This version does not include pip.
If you download and install python3 from python.org, then you will get pip3 as the command to install python modules for python3.
If you download an updated version of python 2.7 from python.org, that will come with pip. At which point, pip will install stuff for python2, and pip3 will install stuff for python3. The two installations are entirely separate.
As jmh points out, if you just want to add pip to the existing OS-bundled python 2.7, then there's an easy command to do that.
sudo easy_install pip
This post is less about the python language, but more about the recommended installation. I just did a fresh install of my MacBook (deleted all data). I did a bit of an oopsy during the reinstallation, so I had to start at El Capitan, until I could get it updated to Monterey.
I digress, I want to set it up as clean as possible as a coding station, and I need to work with a couple of languages. When I wanted to install python 3 I checked if I already had it on there with the install, and I got a couple of weird responses.
% python --version zsh: command not found: python % python3 --version Python 3.9.6 % pip --version zsh: command not found: pip % python3 -m ensurepip --upgrade Defaulting to user installation because normal site-packages is not writeable Looking in links: /var/folders/lw/3k8v5qm91qzgnvhyf3h0qkdc0000gn/T/tmpph98ri4e Requirement already satisfied: setuptools in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages (58.0.4) Requirement already satisfied: pip in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages (21.2.4)
How should I proceed? Shall I do an extra install of python/pip using brew? Should I source this pip? Should I install a different environment manager (miniconda/mamba/pipenv)? What is recommended?