0

Background:

I have been learning Python (on MacOS) for about three months now. I began by installing Python 3.7 through Anaconda and predominantly used Jupyter Notebook to write code. As I learnt more, I found out about different text editors and IDEs, and tried out different programs: IDLE, Sublime and PyCharm.

As I progressed I also learned about package management systems, such as pip and conda, and other such wonderful things that helped me achieve the things I wanted.

The Problem:

Problems surfaced after I installed PyCharm and Python 3.9.

My computer now has four or five different versions of Python installed (2.7, 3.7, 3.8, 3.9) - some which I seem to have downloaded multiple times - and now nothing works any more! The modules I have installed using pip don't load properly any more, my gorgeous programs (some of which are over 600 lines long) don't run any more - I can't even run a simple print('hello world') any more.

My files are a mess. I have probably over a 500mb of Python related junk that I don't use. I have tampered with PATHs and bins in the console, and I don't even know how to begin to sorting this out.

What I Want:

An ideal solution for me would be to just have PyCharm and Jupyter Notebook installed and for them to both be able to import the modules I have installed. I would also like to remove older versions of Python and just have both Jupyter Notebook and PyCharm use 3.9 as their interpreter. Additionally, I would like to safely delete all the junk files that I have collected over the last few months, though I understand that you might not be able to help me with that.

In short: I just want everything to work again!

I spent weeks writing a program that was basically finished and now doesn't even make it passed the second line without throwing out an error.

What can I try next? I am open to anything, including backing up my files and resetting my whole mac (though I'd like to reserve this as plan C).

halfer
  • 19,824
  • 17
  • 99
  • 186
jda5
  • 1,390
  • 5
  • 17
  • 1
    Actually you don't need py3.7, 3.8, 3.9 just install the latest version... If you programmed your code in py2 then you probably need py2 to run it or you can convert your code into py3... there is a feature to select project interpreter in pycharm settings – Avishka Dambawinna May 20 '20 at 12:46
  • It's a bit late now, but I use Conda on macOS, it's been nice so far. It doesn't help with the removal/cleaning beforehand, though! – AMC Jun 03 '20 at 02:27

1 Answers1

0

I have solved my own problem but it took quite a bit of investigation, and will outline what I did:

  1. Reset my Mac (this was not necessary but I wanted to do it anyway)
  2. Install home-brew
  3. Install pyenv
  4. Install pipenv

For anyone experiencing the same problems, you should look definitely into pyenv and pipenv as a way of managing your Python versions and modules.

I won't go into too much detail, as plenty of other already have, but will post some links to some good articles that helped me:

https://opensource.com/article/19/5/python-3-default-mac

https://realpython.com/intro-to-pyenv/

https://pipenv-fork.readthedocs.io/en/latest/

Hope this helps.

jda5
  • 1,390
  • 5
  • 17