I am learning Python and accidentally uninstalled some Python 2.7 essential files from my Mac, and began running into some problems. I researched and apparently python 2.7 comes with macOS and is essential for the system. I have important files on my computer and would hate to have to reinstall macOS. I just saw that there is a software update available. If I update the software will these essential files be restored?
-
You should still be able to install python, maybe install the latest one 3.7 and it should still work without the essential files that were installed previously with the macOS system, don't have to re-install macOS, but yes doing a software update may help in restoring the base files. See this [link](https://osxdaily.com/2018/06/13/how-install-update-python-3x-mac/) – de_classified Feb 19 '20 at 22:15
-
@FishingCode um, if the system Python was 2.7, then almost certainly, 3.7 is not going to work. – juanpa.arrivillaga Feb 19 '20 at 22:45
-
You actually can do an install of python 3 and above, [link](https://docs.python-guide.org/starting/install3/osx/) and you could install a virtual environment and have a python 3.7 version on it. – de_classified Feb 19 '20 at 22:56
-
homebrew would be the go to source for installing python3.7, some instructions [here](https://opensource.com/article/19/5/python-3-default-mac) – de_classified Feb 19 '20 at 23:00
1 Answers
Hmm, where did you uninstall from? Let's hope you didn't remove it from your System/Library
! See this post here - the discussions/answers may provide some help: How to uninstall Python 2.7 on a Mac OS X 10.6.4?. And yes, @FishingCode could be right - an update may just solve the problem.
Steps you could take:
1) Try updating first!
2) If the update did not work AND your accidental deletions did not affect the system files, then try uninstalling any third-party Python files with:
rm -rf </Library/Frameworks/Python.framework/Versions/VERSION_NUMBER>
(replace VERSION_NUMBER with the Python version you want to remove)
OR
If you installed with pip, pip uninstall <Python>
You can also remove the third-party Python 2.7 from the same path (check the same post I referenced above! The accepted answer details a good plan to follow!).
Then, reinstall the usual way (https://www.python.org).
3) Check with the Apple stores/Apple technician.
Overall Recommendations: I do recommend you install a Python version >= 3! Python 2 support has been deprecated since last year and there are some considerable differences between Python 2 and Python 3.x. You can definitely install the latest version (3.8), too. Hope this helps :)

- 163
- 1
- 10
-
2Python 2 won't "soon" be deprecated; it was deprecated at least a year ago and *did* reach end-of-life at the beginning of 2020. – chepner Feb 19 '20 at 22:49
-
1yup python 2.7 was deprecated very recently, but I believe you could do an install of python 3.7 on macOS even if you have 2.7 on it from the macOS system... – de_classified Feb 19 '20 at 22:58
-
@chepner Oh I see! Haha, my Terminal always has that message with "Python 2 will be deprecated..." Thanks for letting me know :) – MT_dev Feb 19 '20 at 23:12