0

I'm aware that Python 2.7 should not be used or upgraded as macOS comes with Python 2.7 for some pre installed software packages.

My question plainly is: Should the Python 3 version that comes with macOS not be used/upgraded?

For clarification I know Python 3 technically doesn't come pre installed like 2.7 does. According to this a clean installation of macOS will come with /usr/bin/python3 that is really just a stub for installing the command line developer tools, which includes and will install python3. I did go ahead and install the command line developer tools, therefore had Python 3.8.9 (at least this is what I had on a clean install of Monterey 12.1).

The reason for my question is that I wanted the newest version of Python 3 (3.10.1). So I installed it directly from python.org and used their installer (I did not use Home-brew or anything like that). After doing this 'python3 -V' will say 'Python 3.10.1'. This made me pause and wonder "if 2.7 should not be messed with, should that original Python 3.8.9 that came with installing the command line developer tools also not be messed with?"

cj650498
  • 9
  • 2
  • 1
    Python versions are kept separate: if you know where `Python 3.8.9` was located, it is probably still there (unless during the installation, you removed it). This is why, when you upgrade to Python 3.10, you have to reinstall all of the packages, because the versions are kept separately. – Kraigolas Jan 06 '22 at 00:32
  • 1
    You're best off not using system-installed versions of Python for anything else. You can, but if you rely on them, you'll have to accept that you're not in control of the versioning. Generally, it's better to separately install the version you need, and create virtual environments off of that for your projects. – Grismar Jan 06 '22 at 00:34
  • @Grismar by 'generally it's better to separately install the version you need, and create virtual environments off of that for your projects' what do you mean by separately? – cj650498 Jan 06 '22 at 00:42
  • Use a virtual environment tool like Conda or virtualenv to separate the Python installations – Jan Wilamowski Jan 06 '22 at 01:21
  • What I meant was to install the version of Python you need in a location where you're allowed to install it, instead of trying to update the system-wide available version of Python that came with the OS. You can then use a virtual environment tool like @JanWilamowski suggests. I'd recommend `virtualenv` since it's most commonly used, but `conda` is very popular in science and engineering settings as well, so you might want to pick whatever your colleagues are using, if you're using it professionally. – Grismar Jan 06 '22 at 01:23
  • @JanWilamowski Let's say I use virtualenv to separate the Python installations. How is this done? I know how to use venv to create an environment and use python3 inside of it, but it sounds like you're saying there's a way to actually install a version of Python 3 inside of the environment itself. Am I understanding you correctly? – cj650498 Jan 06 '22 at 02:36
  • yes, environments can (and usually do) have separate Python installations. I'm not familiar with virtualenv but in Conda, you can install it like any other dependency. – Jan Wilamowski Jan 06 '22 at 02:39

0 Answers0