What do you think is the best way to install and maintain python and Jupyter lab on Mac in 2025?
It’s a mess on my current machine. Quickly running python in a terminal for a quick job uses a different version with different packages than Jupyter lab. Typing “python3” in the terminal doesn’t default to the most recent. At some point anaconda was installed.
What’s the cleanest way for a new machine to have an organized python environment? 90% of what I do is in Jupyter lab.
How can I install a previous version of Python 3 in macOS using homebrew? - Stack Overflow
python - How do I install pip on macOS or OS X? - Stack Overflow
How to install python requests on macos? - Stack Overflow
Does Python still come pre-installed?
Short Answer
To make a clean install of Python 3.6.5 use:
brew unlink python # ONLY if you have installed (with brew) another version of python 3
brew install --ignore-dependencies https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb
If you prefer to recover a previously installed version, then:
brew info python # To see what you have previously installed
brew switch python 3.x.x_x # Ex. 3.6.5_1
Long Answer
There are two formulas for installing Python with Homebrew: python@2 and python.
The first is for Python 2 and the second for Python 3.
Note: You can find outdated answers on the web where it is mentioned python3 as the formula name for installing Python version 3. Now it's just python!
By default, with these formulas you can install the latest version of the corresponding major version of Python. So, you cannot directly install a minor version like 3.6.
Solution
With brew, you can install a package using the address of the formula, for example in a git repository.
brew install https://the/address/to/the/formula/FORMULA_NAME.rb
Or specifically for Python 3
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/COMMIT_IDENTIFIER/Formula/python.rb
The address you must specify is the address to the last commit of the formula (python.rb) for the desired version. You can find the commint identifier by looking at the history for homebrew-core/Formula/python.rb
https://github.com/Homebrew/homebrew-core/commits/master/Formula/python.rb
Python > 3.6.5
In the link above you will not find a formula for a version of Python above 3.6.5. After the maintainers of that (official) repository released Python 3.7, they only submit updates to the recipe of Python 3.7.
As explained above, with homebrew you have only Python 2 (python@2) and Python 3 (python), there is no explicit formula for Python 3.6.
Although those minor updates are mostly irrelevant in most cases and for most users, I will search if someone has done an explicit formula for 3.6.
I have tried everything but could not make it work. Finally I have used pyenv and it worked directly like a charm.
So having homebrew installed, just do:
brew install pyenv
pyenv install 3.6.5
to manage virtualenvs:
brew install pyenv-virtualenv
pyenv virtualenv 3.6.5 env_name
See pyenv and pyenv-virtualenv for more info.
EDIT (2020/03/19)
I have found using the pyenv-installer easier than homebrew to install pyenv and pyenv-virtualenv direclty:
curl https://pyenv.run | bash
To manage python version, either globally:
pyenv global 3.6.5
or locally in a given directory:
pyenv local 3.6.5
EDIT (2025/12/19)
Just use uv
On Linux or MacOS:
python -m ensurepip --upgrade
If you want to install pip for Python 3, replace python with python3.
See https://pip.pypa.io/en/stable/installation/ for more details.
⚡️ TL;DR — One-line solution.
Run the following command for Python v2.7 (default on Mac as of 2021)
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py | python
Run the following command for Python v3
curl https://bootstrap.pypa.io/get-pip.py | python
Or the following if you have it installed as Python 3
curl https://bootstrap.pypa.io/get-pip.py | python3
Another GIF image you said? Here you go!

The following used to work in 2019 and before
All you had to do was:
sudo easy_install pip
2019: ⚠️easy_install has been deprecated. Check Method #2 below for the preferred installation!
Details:
⚡️ OK, I read the solutions given above, but here's an easy solution to install
pip.
The macOS comes with the Python environment installed. But to make sure that you have Python installed open the terminal and run the following command.
python --version
If this command returns a version number that means Python exists. This also means that you already have access to easy_install considering you are using macOS or OS X.
ℹ️ Now, all you have to do is run the following command.
sudo easy_install pip
After that, pip will be installed and you'll be able to use it for installing other packages.
P.S. I ended up blogging a post about it. QuickTip: How Do I Install pip on macOS or OS X?
✅ Method #2: Two line solution
easy_install has been deprecated. Please use get-pip.py instead.
Download and install PIP
curl https://bootstrap.pypa.io/get-pip.py | python
If you installed python3 via brew, installing python libs globally is not allowed anymore:
pip3 install requests
Fails with the error: "This environment is externally managed"
brew install python-requests
Fails with the error: "Error: python-requests has been disabled because it does not meet homebrew/core's requirements for Python library formulae! It was disabled on 2024-06-23"
Solution: Luckily the solution is stated in the first error message, you have to create a virtual environment instead of a globally installed lib with:
python3 -m venv path/to/venv
source path/to/venv/bin/activate
python3 -m pip install requests
To install Python packages system-wide, try brew install
xyz, where xyz is the package you are trying to
install.If you wish to install a Python library that isn't in Homebrew, use a virtual environment: python3 -m venv path/to/venv source path/to/venv/bin/activate python3 -m pip install xyz If you wish to install a Python application that isn't in Homebrew, it may be easiest to use 'pipx install xyz', which will manage a virtual environment for you. You can install pipx with brew install pipx
So:
brew install pipx
then
pipx install requests --include-deps