Brew Python3

  



After resolving the linking issue (e.g. Python3 is installed but not pip3. Reinstalling python (e.g. Brew reinstall python) eventually installs pip3 as well. These steps works well for me. I installed python3 using homebrew but it didn't install pip3 or should I say it installed but it doesn't recognize the command? Here is what I did: brew install python3 This installed python3. Python has been installed as $(brew -prefix)/opt/python@3.8/bin/python3 Unversioned symlinks `python`, `python-config`, `pip` etc. Python has been installed as $(brew -prefix)/opt/python@3.8/bin/python3 Unversioned symlinks `python`, `python-config`, `pip` etc.

  • Install Homebrew


    Paste that in a macOS Terminal or Linux shell prompt.

    The script explains what it will do and then pauses before it does it. Read about other installation options.

  • What Does Homebrew Do?


    Homebrew installs the stuff you need that Apple (or your Linux system) didn’t.

  • Homebrew installs packages to their own directory and then symlinks their files into /usr/local.

  • Homebrew won’t install files outside its prefix and you can place a Homebrew installation wherever you like.

  • It’s all Git and Ruby underneath, so hack away with the knowledge that you can easily revert your modifications and merge upstream updates.

  • Homebrew complements macOS (or your Linux system). Install your RubyGems with gem and their dependencies with brew.

  • “To install, drag this icon…” no more. Homebrew Cask installs macOS apps, fonts and plugins and other non-open source software.

  • Donate to Homebrew

  • Homebrew Blog

  • Analytics Data

  • Homebrew was created by Max Howell. Website by Rémi Prévost, Mike McQuaid and Danielle Lalonde.

Question or issue on macOS:

I just switched from MacPorts to HomeBrew. After installing all the required XCode versions and other software I tried installing python using homebrew: I think it successfully installed, but when I do which python it still shows me 2.7.3 which I think is the version shipped with Mountain Lion.

Python3

so I tried to install again

But it says python 2.7.5 already install and not linked, I tried to do brew link python

That led me to following message so, I have no idea what I should be doing:

Linking /usr/local/Cellar/python/2.7.5… Warning: Could not link python. Unlinking…

How to solve this problem?

Solution no. 1:

Python

After installing python3 with brew install python3
I was getting the error:

After typing brew link python3 the error was:

To solve the problem:

After this, I could open python3 by typing python3 👍

(From https://github.com/Homebrew/homebrew-core/issues/20985)

Brew Python3 Pip

Solution no. 2:

In the Terminal, type:

Solution no. 3:

If you used

before ‘unlink’
you got

so do

and open a new terminal shell

Solution no. 4:

On OS X High Sierra, I had to do this:

credit to https://gist.github.com/irazasyed/7732946#gistcomment-2235469

I think it’s better than recursively chowning the /usr/local dir, but that may solve other problems 😉

Solution no. 5:

I think you have to be precise with which version you want to link with the command brew link python like:

It will give you an error like that:


Linking /usr/local/Cellar/python3/3.5.2…
Error: Could not symlink bin/2to3-3.5
Target /usr/local/bin/2to3-3.5
already exists.

You may want to remove it:

To force the link and overwrite all conflicting files:

To list all files that would be deleted:

but you have to copy/paste the command to force the link which is:

I think that you must have the version (the newer) installed.

Solution no. 6:

brew switch to python3 by default, so if you want to still set python2 as default bin python, running:

Solution no. 7:

You can follow these steps.

Solution no. 8:

Brew Python 3.8

This answer is for upgrading Python 2.7.10 to Python 2.7.11 on Mac OS X El Capitan . On Terminal type:

After that type on Terminal

Brew Python3 Book

Solution no. 9:

The problem with me is that I have so many different versions of python, so it opens up a different python3.7 even after I did brew link. I did the following additional steps to make it default after linking

First, open up the document setting up the path of python

Then something like this shows up:

The thing here is that my Python for brew framework is not in the Library Folder!! So I changed the framework for python 3.7, which looks like follows in my system

Change and save the file. Restart the computer, and typing in python3.7, I get the python I installed for brew.

Not sure if my case is applicable to everyone, but worth a try. Not sure if the framework path is the same for everyone, please made sure before trying out.

Solution no. 10:

I use these commands to solve it.

Hope this helps!