How to get rid of Python2.7 pre-installed by Apple

Mac comes with Python2.7 installed by Apple.

I needed to use a more recent version so I installed Python3.8.

I followed an article, I found online on  www.macupdate.com/app/mac/5880/python/uninstall  

to get rid of Python2.7 before installing Python3.8.


I think I botch something in trying to eliminate Python2.7 from my Mac.


I opened a terminal and launched python. Unluckily The old pre-installed version is still there.


mauramonville@Mauras-MacBook-Pro ~ % python --version

Python 2.7.16


mauramonville@Mauras-MacBook-Pro /usr % ls

X11      bin      libexec      sbin     standalone

X11R6        lib      local        share


I looked for files whose name contains the string "python" and found traces of both Python versions.


mauramonville@Mauras-MacBook-Pro /usr % pwd

/usr


mauramonville@Mauras-MacBook-Pro /usr % find . -name "python*" -print

./bin/python3

./bin/python

./bin/python2

./bin/pythonw

./bin/python2.7-config

./bin/pythonw2.7

./bin/python-config

./bin/python2.7

find: ./sbin/authserver: Permission denied

./local/bin/python3

./local/bin/python

./local/bin/python3.8

./local/bin/python3-config

./local/bin/python3.8-config

./lib/python2.7

./share/man/man1/python2.7.1

./share/man/man1/pythonw2.7.1

./share/man/man1/python.1

./share/man/man1/pythonw.1

./share/vim/vim82/indent/python.vim

./share/vim/vim82/ftplugin/python.vim

./share/vim/vim82/autoload/python3complete.vim

./share/vim/vim82/autoload/pythoncomplete.vim

./share/vim/vim82/syntax/python.vim

./share/file/magic/python

 

I notice a mixture of python2.7 (pre-installed by Apple) and python3.8 (installed by myself).

 

mauramonville@Mauras-MacBook-Pro local % pwd

/usr/local


mauramonville@Mauras-MacBook-Pro local % find . -name "python*" -print

./bin/python3

./bin/python

./bin/python3.8

./bin/python3-config

./bin/python3.8-config

 

How can I get rid of python2.7 and use python3.8 instead?

 

Thank you so much in advance.

 

   Best regards,

     mauede33

 

 

MacBook Pro 16″, macOS 11.5

Posted on Aug 27, 2021 12:50 AM

Reply

Similar questions

3 replies

Aug 27, 2021 4:39 AM in response to mauede33

The Python 2.7.16 that Apple installs is part of the operating system and some of Apple's System, and applications may still need it to function properly. Leave it alone.


I use the Python3.9.6 installer from Python.org and it is a proper macOS installer that places the Python Framework into /Library/Frameworks/Python.framework — where it does not step on any pre-existing Apple Python installation. It links binaries from that Library location back into /usr/local/bin as python3, idle3, etc. A simple PATH correction allows you to access python3 from that location, in addition to Apple's Python 2.7.16.


If you install Xcode 11.3 (or later) or the command line tools for Xcode 11.3 (or later) — either will install an Apple python 3.8.2 library into the operating system and the python3 binary will be in /usr/bin. I never use it, even though I have the latter development product installed.


And lastly, I created an arbitrarily named folder in my home directory (e.g. py39venv) that contains my Python 3.9.6 virtual environment where I install any third-party Python packages (e.g. PyObjC, Qt, etc.) for development with those technologies.

Aug 27, 2021 5:24 AM in response to mauede33

mauede33 wrote:

I followed an article, I found online on  www.macupdate.com/app/mac/5880/python/uninstall  
to get rid of Python2.7 before installing Python3.8.

I think I botch something in trying to eliminate Python2.7 from my Mac.

You didn’t botch anything. Those instructions are ridiculously wrong.


You can’t remove any system software. But you can easily install whatever version of Python you want. You can adjust your path and symbolic links to use only Python3 as described above.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to get rid of Python2.7 pre-installed by Apple

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.