Home:ALL Converter>Python: Python version in Mac

Python: Python version in Mac

Ask Time:2021-06-30T13:04:58         Author:Kar

Json Formatter

Issue: When I typed python -V, It gives me python 2.7.16 which is Apple's inbuilt system instead of python3.7

Initially, I followed the below steps and installed the latest python version which is 3.9 and it worked fine perfectly

brew install python

Since I use zsh by default, I put the following into the .zshrc file:

$ echo "alias python=/usr/local/bin/python3" >> ~/.zshrc

But my project required a python3.7 version so I have uninstalled it using brew uninstall [email protected] and then installed brew install [email protected]

Also ran echo "alias python=/usr/local/bin/python3" >> ~/.zshrc

But now when try to run python -V it points to the Python2.7 version not Python 3.7 version

Also check where it is installed

% which pip3
/usr/local/opt/[email protected]/bin/pip3
% which python
/usr/bin/python
% which python3                                                                                                                                                         
/usr/local/opt/[email protected]/bin/python3

Need help to fix this issue.

Author:Kar,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/68188723/python-python-version-in-mac
yy