JackeyOL
JackeyOL

Reputation: 321

How to set Python3.9 the default for python3 on mac?

I had my previous python3.7 installed by Anaconda and then I installed python3.9 using homebrew. Then things really messed up. When I check my packages using pip3 list, it shows no packages installed. I suppose it was sourcing the site-packages under python3.9. However, when I run python in terminal (which python3), it showed that I was still running the old python3.7 which had all my packages. The problem is whenever I installed new packages, it didn't work because I was still running the old python3.7 while new packages were installed to python3.9.

Question:

  1. How can I make my python version consistent, e.g. I only want to use one python and preferably the later version --python3.9.
  2. How should I manage my packages. There are a lot of them and I really don't want to install every single one again on python3.9

Thank you very much!

Upvotes: 0

Views: 369

Answers (1)

Insula
Insula

Reputation: 953

Make a list of your pip installed pacakages:

pip3 freeze > my_packages.txt

Uninstall python3.7:

sudo rm -rf /Library/Frameworks/Python.framework/Versions/3.7

With your new install of python3.9, install the previous packages:

pip3 install -r my_packages.txt

Upvotes: 1

Related Questions