Note that upgrading Python with Homebrew causes all my virtual envs to break. Using
pyenv is safer.
I had 3 versions of PY3 installed.
The system default is Python3.7.
$ python3 -V Python 3.7.3 $ which python3 /usr/bin/python3
And Python 3.8 was known by Brew.
$ brew info python email@example.com: stable 3.8.6 (bottled)
Python 3.9 got installed because sphinx-doc has it as a dependency, but it did not replace the existing one. See notes from the output.
==> firstname.lastname@example.org Python has been installed as /usr/local/bin/python3 Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to `python3`, `python3-config`, `pip3` etc., respectively, have been installed into /email@example.com/libexec/bin You can install Python packages with pip3 install <package> They will install into the site-package directory /usr/local/lib/python3.9/site-packages See: https://docs.brew.sh/Homebrew-and-Python firstname.lastname@example.org is keg-only, which means it was not symlinked into /usr/local, because this is an alternate version of another formula. If you need to have email@example.com first in your PATH run: echo 'export PATH="/firstname.lastname@example.org/bin:$PATH"' >> ~/.zshrc For compilers to find email@example.com you may need to set: export LDFLAGS="-Lfirstname.lastname@example.org/lib" For pkg-config to find email@example.com you may need to set: export PKG_CONFIG_PATH="/firstname.lastname@example.org/lib/pkgconfig"
Try this to sort out the linking.
$ brew unlink python && brew link python
Unlinking /usr/local/Cellaremail@example.com/3.8.6... 2 symlinks removed Linking /usr/local/Cellarfirstname.lastname@example.org/3.8.6... Error: Could not symlink bin/pip3 Target /usr/local/bin/pip3 is a symlink belonging to email@example.com. You can unlink it: brew unlink firstname.lastname@example.org To force the link and overwrite all conflicting files: brew link --overwrite email@example.com To list all files that would be deleted: brew link --overwrite --dry-run firstname.lastname@example.org
$ brew unlink python $ brew link email@example.com Warning: firstname.lastname@example.org is keg-only and must be linked with --force If you need to have this software first in your PATH instead consider running: echo 'export PATH="/email@example.com/bin:$PATH"' >> ~/.zshrc
$ brew link firstname.lastname@example.org --force Linking /usr/local/Cellaremail@example.com/3.9.0... 21 symlinks created If you need to have this software first in your PATH instead consider running: echo 'export PATH="/firstname.lastname@example.org/bin:$PATH"' >> ~/.zshrc
$ python3 -V Python 3.7.3
Create by hand:
$ cd /usr/local/opt $ ln -s ../Cellaremail@example.com/3.9.0 firstname.lastname@example.org $ ln -s ../Cellaremail@example.com/3.9.0 python@3
Then you can add this to
Also I can’t just delete the old one as it is used by other Brew packages.
$ brew uninstall firstname.lastname@example.org Error: Refusing to uninstall /usr/local/Cellaremail@example.com/3.8.6 because it is required by ipython, libxml2 and libxmlsec1, which are currently installed. You can override this and force removal with: brew uninstall --ignore-dependencies firstname.lastname@example.org
Doing an install of Python 3.9 made it the default without having to update my
$ brew upgrade email@example.com
/usr/local/bin/python3 links to