0

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.
>>> exit()
charlieharrison@MacBook-Pro-4 ~ % pyenv versions
  system
* 3.10.6 (set by /Users/charlieharrison/.python-version)
charlieharrison@MacBook-Pro-4 ~ %
George Udosen
  • 906
  • 1
  • 13
  • 28
  • 1
    Have a look at using python virtual environments to utilize the version of python of your choice. Updating the default python version on a mac is problematic as it is used by the OS itself. stackoverflow.com/questions/1687357/updating-python-on-mac – j_b Sep 18 '22 at 12:29

1 Answers1

0

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

ln -s -f /usr/local/bin/python3.10 /usr/local/bin/python
Michal
  • 338
  • 1
  • 3
  • 11
  • This isn't the best solution for OP – George Udosen Sep 18 '22 at 12:39
  • It solves his problem for having a specific version as default isn't? I emphasized that this is the simplest solution, not the best one... If you know a case where the OP would have a problem with my proposal, you should describe exactly what you mean and propose your "best" solution. – Michal Sep 18 '22 at 14:30
  • Hello, I've also tried adding Python 3 to my PATH. I opened the .bash_profile using TextEdit; then I added #Add Python 3.10 to PATH PATH="/usr/local/bin/python3.10.5/bin:${PATH}" export PATH; then I restarted the terminal & checked the path, but it was the same as before!! % echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin – Charlie Harrison Sep 21 '22 at 11:42