Python: Python version in Mac
NickName:Kar Ask DateTime:2021-06-30T13:04:58

Python: Python version in Mac

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.

Copyright Notice:Content Author:「Kar」,Reproduced 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

More about “Python: Python version in Mac” related questions

Python Version help on Mac

I currently have Python3.9 installed on my mac but when I used python3 --version it says that I am still using python3.7. I am currently trying to switch the version but I do not want to effect the

Show Detail

mac os Catalina 10.15.2 built in python version

How could I check what is the built in python version for mac os Catalina 10.15.2. Have a problem with "/Library/Frameworks/Python.framework/Versions/3.5/". Think to remove this version and reinst...

Show Detail

Homebrew python version different than Mac python version?

I've searched a while and haven't found an answer to this particular issue. brew info python returns python: stable 3.7.7 (bottled), HEAD However, python -V and python3 -V return Python 3.6.1 ::

Show Detail

Unable to locate to the right version of python on Mac

The big picture: I am trying to let rPython package run python scripts that have packages such as numpy, scipy, and scikit-learn. Now, if that is an impossible task, please let me know right away,

Show Detail

What is the latest version of Python that works for Mac OS 10.4?

What is the latest version of Python that works for Mac OS 10.4.11? (This would be a version of Python 3 unless none of those work for that OS.) When I looked on the Python website for Python 3, ...

Show Detail

Python using wrong version on Mac

I'm new to Python, I'm using version 3.8.2 on Sublime Text and Mac. I aliased the python version from 2.7 to 3 on the command terminal and it works fine whenever I check for the version on the ter...

Show Detail

Mac : Restore default python version

I installed Anaconda, python changed in that given by this distribution and I used it happily. Now I want to build some libraries (e.g. Fenics) and I need the default Mac version of python. What...

Show Detail

Changing the default python version on Mac - Installing Biopython

My Mac came installed with python 2.7 as the default python version. But, this version is no longer supported by many packages and software. I searched several online forums regarding how to change...

Show Detail

Install python module to non default version of python on Mac

I have a couple different versions of Python installed on my Mac. The default version is 2.5, so when I install a module it gets installed to 2.5. I need to be able to install some modules to a dif...

Show Detail

How to set path for latest version of Python on mac

I have downloaded latest Python version 3.5 on my Mac OSX 10.9.5. It is stored in Applications. If I type python --version in Terminal, I get Python 2.7.5 which is in directory /usr/bin/. How can I...

Show Detail