angry kiwi
angry kiwi

Reputation: 11445

installed python 3x on mac but terminal still show version still 2x

I installed python 3x via home brew, the process was successful.

However when I check version, it shows 2x

here is the terminal output

➜  ~ brew install python
Warning: python 3.7.2 is already installed, it's just not linked
You can use `brew link python` to link this version.
➜  ~ brew link python
Linking /usr/local/Cellar/python/3.7.2... Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks
➜  ~ sudo brew link python
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
➜  ~ python -V 
Python 2.7.10

I think I need to modify some kind of path. And do some magic then pray...lol

Anyway anyone know how to get this work on my machine? I'm mac latest

Upvotes: 1

Views: 325

Answers (3)

richmail
richmail

Reputation: 11

you have to use python3 instead of python on Mac so like python3 path/to/file.py and pip is now pip3 so like pip3 install pillow

Upvotes: 0

richmail
richmail

Reputation: 11

you could do brew uninstall python3 and install it from the python website here https://www.python.org/

When you go install a module you do pip3 install packageName And when you run a program you could run it from your IDE (I recommend VSCode) or run it from the terminal with python3 drag_python_file_here

Upvotes: 0

Ortomala Lokni
Ortomala Lokni

Reputation: 62486

First, solve your permission problem by running the official command from the Homebrew Documentation, Troubleshooting page

cd /usr/local && sudo chown -R $(whoami) bin etc include lib sbin share var opt Cellar Caskroom Frameworks

Then run brew link python

And finally run echo $PATH and check that your /usr/local/bin has precedence over other directories.

Upvotes: 1

Related Questions