Installing Python3.6 alongside Python3.7 on Mac

I'm trying to install tensorflow onto a Mac with Python3.7. However, I'm getting the error:

$ pip3 -v install tensorflow ... Skipping link (from ); it is not compatible with this Python Could not find a version that satisfies the requirement tensorflow (from versions: ) Cleaning up... Removed build tracker '/private/var/folders/4n/9342s4wd3jv0qzwjz8rxrygr0000gp/T/pip-req-tracker-3p60r2lo' No matching distribution found for tensorflow 

From what I can gather this is happening because tensorflow doesn't yet support Python3.7. As a workaround I want to install Python3.6 alongside 3.7 and then install tensorflow to that version. However, I'm new to Mac and not sure of the correct way to do this without potentially messing with the preexisting Python version.

I've tried using brew, but it looks like Python3 is as specific as it gets. What is the correct way to do what I'm after?

3 Answers

Try using brew for example if already using Python 3:

$ brew unlink python 

Then install python 3.6.5:

$ brew install --ignore-dependencies 

To get back to python 3.7.4_1 use:

$ brew switch python 3.7.4_1 

And if need 3.6 again switch with:

$ brew switch python 3.6.5_1 
7

If you are using mac, you can install pyenv from Brew, install the desired versions, list the installed versions, and activate each version locally or globally.

brew install pyenv pyenv install 3.6.9 pyenv install 3.7.4 pyenv versions pyenv global 3.7.4 3.6.9 
$ python3.6 --version Python 3.6.9 $ python3.7 --version Python 3.7.4 

PS: Global activation worked only after restarting the computer. You need to prepend $(pyenv root)/shims to the left of your PATH environment variable.

6

When you mess around with system python versions, I strongly recommend using pyenv - it makes life so much easier. You would simply run

brew install pyenv pyenv install 3.6.5 pyenv install 3.7.4 

Then you can run pyenv local [python version]

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like