TransWikia.com

I tried to remove Python and think I may have broken my whole operating system (Mac)

Stack Overflow Asked by Nicole Aragon on January 17, 2021

So over the summer I tried switching to Python3 and wanted to get rid of all previous Python versions on my computer. I just went through the files on my computer and threw anything that said Python in the trash. I’ve been having issues running Python scripts on my computer every since and as I’ve been digging online for help on uninstalling and reinstalling Python, I’ve seen many people warn not to delete Apple-supplied system Python. I’m getting the feeling I may have done this….

What can I do if that is the case? Am I completely doomed? Is there a way to check what files should be on my computer and which shouldn’t?

This has been really inhibiting me from doing work and I would love to get to the root of this issue. I have run commands in the terminal to install Python3 and force link it but my issues persist and I can’t run Python scripts that work perfectly well on my coworkers computers.

I’m currently using Visual Studio Code and when I run my script I get an error that says

/bin/sh: python: command not found

or when I run my script using the terminal

python3 Desktop/folder/file.py

it’ll say:

[Errno 2] No such file or directory

I’ve been struggling with this for months, I believe there’s something going on with my operating system. Any help is appreciated!

2 Answers

Backup and then re-install the OS.

That's all pretty easy to do with a mac. But if you've removed things out of the OS folders and you're not sure what, the only real way to get back to normal is to reinstall

Answered by Richard on January 17, 2021

This is not a complete answer, I can update as more information comes in. I noticed a couple of issues, so wanted to point them out. First:

/bin/sh: python: command not found

Depending on the environment, you might not have a python even if everything is correct. You might only have a python3. To test, try:

python3 -V

so if need be, you could edit files to call the correct executable, or perhaps make a symlink, like one of these:

ln -s /bin/python3 /bin/python
ln -s /usr/bin/python3 /usr/bin/python

Then this:

python3 Desktop/folder/file.py
[Errno 2] No such file or directory

You probably should be calling /Desktop instead of Desktop, depending on the current directory.

Answered by Steven Penny on January 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP