10

I had python2 installed on my macOS and I parallel installed python3 (without homebrew). It worked perfect and I could use python3 and pip3 from every directory without problems parallel to python and pip for version 2.

Some days ago I did not find pip3 and I had to set an alias to python3 -m ... (I thought I didn't use it before but I had!). Today in the morning I worked with python3 without problems and now python3 got a command not found but I cannot find it on my directories, too.

Where is my python3? And why it is gone?

The only reason I see is that I installed homebrew about a week ago for installing mutt. Is it possible that the brew upgrade function has destroyed paths or even installations?

Would be great to get help from you! Thanks a lot.

12
  • its hard to say without knowing how you installed python3
    – avigil
    Mar 3, 2018 at 15:24
  • @avigil I searched in my todo-files but I did not find it. I keep searching ... Mar 3, 2018 at 15:32
  • the homebrew changelog mentions some changes to the python formula released on March 1 that may have caused your issue: brew.sh/2018/01/19/homebrew-1.5.0
    – avigil
    Mar 3, 2018 at 15:38
  • I found that python was in /usr/bin/python and python3 was located in /usr/local/bin/python3. But now both places I can only find python3. Very mysterious ... Is there a possibility to update only /usr/local/bin/python2 again to 3 without losing all libraries I installed before? But do this change at homebrew can downgrade my python? Mar 3, 2018 at 15:46
  • 1
    If a command is not available, it means you have modified your PATH variable. In your .bash_profile file, modify PATH so that it includes /usr/local/bin directory: PATH="${PATH}":/usr/local/bin. At the end of the file, add line export PATH, restart the terminal.
    – hoefling
    Mar 3, 2018 at 16:46

3 Answers 3

5

Maybe someone else has the same problem. Therefore the steps for my solution:

  • the which command shows me the directories of the versions linked everywhere in the system
  • the argument --version gave me an overview of where I found the different versions of python and vim (for more informations about the directory-changes I checked vim, too)
  • looking at echo $PATH and ls -lha /etc/paths* I knew more about the current sequence of possible directories of installations and about changes (brew saved the original file as /etc/paths~orig)
  • with these informations I first upgraded with brew upgrade python3 (it seems that my installed libraries stayed like in the days before the mysterious loss of python3), then I could change the paths and add some alias to get the environment I want to work with

Now everything seems to be like before the problems. If I will notice any further changes I now have the knowledge to solve them within some minutes. Good feeling!

It's not solved why brew downgraded the python3-installation because I'm sure not having installed it in the days of adding python3 to python2. But that isn't very important.

Thanks to the helpers - especially @avigil.

1
  • Great. Then it was a good decision to explain my workflow to the solution. Mar 23, 2018 at 16:25
4

I had the same strange behavior after a brew upgrade: python 3 suddenly disappeared.

brew install python3

told me that

python 2.7.14 is already installed
To upgrade to 3.6.5, run `brew upgrade python`

So that is what I did. The homebrew install of python 2 is gone now, but can be installed again using brew install python@2 .

1

In case this helps, I had a similar problem where a homebrew upgrade made python3 seem to disappear.

brew install python3

...told me python3 was already installed and just needed to be linked with

brew link python

Ran it, and the symlinks it created seem to have resolved the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.