Python Problems & Terminal Troubles

I don’t know anything about Python (or any other scripting languages), and I don’t know anything about the terminal, But I do know enough about web-searches and copy-paste to be a threat to my system.

I think I hosed Python while trying to get Marked2 working with CritMarkup on an M1 Mini. Many of my automation workflows stopped working (and I didn’t solve the Marked2 problem either). I am in way over my head and I don’t even know where to start to get back to normal. It looks like I have Python3 installed, but it may not be in the right location (or maybe it’s the wrong version?), and now I’m afraid that I will just make things worse if I keep mucking around…

Any sage advice would be appreciated.

Some system installed software needs Python 2 (still? Come on Apple, let’s get with the program). This should help you restore it. Restore Python 2.7 on Monterey 12.3? - Ask Different

I cannot help you solve the issue if the native Python installation is botched, but my advice is to always install programming languages via homebrew (and in the Python case, create virtualenvs) to avoid these undesirable situations.

2 Likes

Tried it… It seems to be working. I still have the problem with Marked2, but I’m no longer getting errors in other areas.

Thanks!

1 Like

@katzy Glad you got it working!

If there are problems in the future — as @pantulis says, virtual environments are the way to go. I keep coming back to this post whenever I need to set up Python on a new Mac: The right and wrong way to set Python 3 as default on a Mac.

It includes the obligatory XKCD comic. :rofl:

4 Likes

It might be interesting, to post a “how to” with an advice like that… :thinking: :wink:

Apple system SW requires Python 2.7

Having messed mine up once I was able to restore it by reinstalling over the top of the system version.

From then on I use a virtual environment from within PyCharm. That keeps it cleaner and I can test my code on all the flavors of Python I am supporting. PyCharm supports a relatively easy way to set up the virtual environment I was able to just follow the help file to do it.

I think the easiest and best documented say to setup virtual environments is to use the “free of cost” Anaconda.

And yes, don’t mess with the Python as installed by the system as the system uses it.