Ryan Lindsey
Ryan Lindsey

Reputation: 123

How can I move from the default pre-installed Python 2.7 on my Mac to accessing Python 3.7 from Anaconda in Terminal?

I may be leaving out many details, but I'll attempt to construct the best picture of what is happening here.

My Mac is running OS Catalina 10.15.6, I got it back in April, and it has Python 2.7 in

I'm learning to use pip install and PyPI from terminal, and the first oddity I noticed was that I had to install pip. I shouldn't have, because it comes with Anaconda Navigator. So I did sudo easy-install pip and it installed. Then I did pip install requests which worked fine, then pip install colorama and then it threw this error message:

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: colorama in ./Library/Python/2.7/lib/python/site-packages (0.4.3)

My desire is to be able to use the Anaconda Python from terminal, since this 2.7 Python is dying and I need to be able to do so for my upcoming bootcamp and current Python course. I tried many conda commands to create an environment, see my current environment, etc, and they all failed because my terminal doesn't recognize conda as a command. I see this:

ryanlindsey@Ryans-MacBook-Pro ~ % conda info --envs
zsh: command not found: conda
ryanlindsey@Ryans-MacBook-Pro ~ % conda create -n myenv python=3.6
zsh: command not found: conda
ryanlindsey@Ryans-MacBook-Pro ~ % conda
zsh: command not found: conda

I've read stack overflow suggestions to add it to my path, but even when I use the code it seems to do nothing.

If this is useful, here is my PATH when I do echo $PATH

/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin

My shell I am using is zsh.

Anyone experienced in solving problems like this?

Upvotes: 0

Views: 706

Answers (1)

benwiggy
benwiggy

Reputation: 2749

MacOS comes with python 2.7 installed by default. You can't move or remove it. Catalina also comes with python 3.7 (though it requires the download of Xcode command line tools when first run to complete it.)

Usually, python 3 versions are instigated with the command python3. Similarly, pip3 manages libraries for python 3, while pip manages libraries for python 2.

It doesn't look like you've actually installed Anaconda. Anaconda is a third-party product, which does not come bundled with the OS. You'll need to install that and follow the instructions on their website.

https://docs.anaconda.com/anaconda/install/

Upvotes: 1

Related Questions