[SOLVED] Cannot set default python version to 3.10.6 using Pyenv


This Content is from Stack Overflow. Question asked by Charlie Harrison

I’m struggling to update my default python to 3.10.6 on Mac. I seem to be able to set the ‘global’ and ‘local’ to the new one (as in code), but this doesn’t impact the default…

Help would be much appreciated, please, as I’m a beginner!!


charlieharrison@MacBook-Pro-4 ~ % pyenv global 3.10.6
charlieharrison@MacBook-Pro-4 ~ % pyenv local 3.10.6
charlieharrison@MacBook-Pro-4 ~ % python

WARNING: Python 2.7 is not recommended.
This version is included in macOS for compatibility with legacy software.
Future versions of macOS will not include Python 2.7.
Instead, it is recommended that you transition to using ‘python3’ from within Terminal.

Python 2.7.16 (default, Mar 25 2021, 03:11:28)
[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc- on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

charlieharrison@MacBook-Pro-4 ~ % pyenv versions

  • 3.10.6 (set by /Users/charlieharrison/.python-version)
    charlieharrison@MacBook-Pro-4 ~ %


Simpliest way is to create a link to latest version, for example:

ln -s -f /usr/local/bin/python3.10 /usr/local/bin/python

This Question was asked in StackOverflow by Charlie Harrison and Answered by Michal It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?