Repair Python 3.5 on macOS – Troubleshooting Guide

developmentpythonsymlinkxcode

Seems that my python3.5 is broken. I can still call it, either with python3.5 or with /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5. But it does absolutely nothing, particularly, it does not open a Python console.

The only thing I did to it was setting a symlink with:

ln -sf /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 python3.5
  1. How can I repair my Python?
  2. Was it really the symlink who caused harm?

Best Answer

Check to see if you got the link command the right way round. What you wrote in your question is correct, but if you had the source and the target the wrong way round when you typed the link command, you could have clobbered the executable. You could also have cobbered the executable if you ran the linking command while in the ...3.5/bin directory.

Check that the executable still looks right with

ls -l /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5

If you have accidentally clobbered it then re-installing is probably the easiest fix.

Using the -f flag is potentially dangerous, since it will replace files without warning. It's good practice to run commands like ln rm and so on without the -f flag, at least initially.