pythonterminalhomebrewpython-install

Terminal shows wrong Python version as default


Typing Python on my Terminal shows

Python 3.9.5 (default, May  4 2021, 03:36:27) 
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

When in fact I have installed the latest version, 3.10.6, which shows when I type python3 --version. Typing just python --version returns 3.9.5 again. It seems that the default version is 3.9.5 and not updated, or am I wrong? Either way, how do I solve this? I've tried both downloading and installing it directly, as well as through brew install ..., both giving successful installs, but not updating the default version (3.9.5 -> 3.10.6)


Solution

  • The solution, as provided in the comments, was to create a ~/.zshrc file (How to create a ~/.zshrc file) and then to replace the existing path with export PATH="$(brew --prefix python@3.10)/libexec/bin:$PATH"