OrangeChicken
OrangeChicken

Reputation: 1

Deleted python files on macOS using rm -rf

I am using MACOS 10.12.6

I was trying to uninstall python to reinstall it, and I foolishly typed these commands into my terminals.

sudo rm -rf /Users/<myusername>/anaconda2/lib/python2.7
sudo rm -rf /Users/<myusername>/anaconda2/lib/python27.zip
sudo rm -rf /Users/<myusername>/anaconda2/lib/python2.7/plat-darwin
sudo rm -rf /Users/<myusername>/anaconda2/lib/plat-mac
sudo rm -rf /Users/<myusername>/anaconda2/lib/plat-mac/lib-scriptpackages

now my Python won't work. I get these errors:

>Could not find platform independent libraries <prefix>
>Could not find platform dependent libraries <exec_prefix>
>Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]

And when I try to run python I get things such as

>ModuleNotFoundError: No module named 'pandas'

I currently cannot do anything which requires python

I came to understand much later that what I did was deleting an important part of python files from my computer.
Is there any way I can reinstall python or is formatting my computer the only option if I want to use Python on this computer?

Upvotes: 0

Views: 119

Answers (2)

OneCricketeer
OneCricketeer

Reputation: 191874

You only deleted Anaconda, not the System Python.

Therefore, you probably only need to edit your PATH variable to remove references to those folders.

Check your ~/.bashrc

Upvotes: 0

Natsfan
Natsfan

Reputation: 4827

Since you used Anconda on your mac you should be able to just reinstall python 2.7. If you still have the install package: Anaconda2-5.2.0-MacOSX-x86_64.pkg, just double click that and follow directions. If you don't have this package, download it from here and when the package downloads completely double-click it.

Upvotes: 1

Related Questions