0

I installed both anaconda2 and anaconda3 on my system. Now I see anaconda prompt terminal option only under anaconda2 in start menu (windows). How do I use the following commands separately for both distributions?

some of my old projects still depends on Python2.7 and I'm yet to migrate it to Python3.X. I like to keep both for the sake of running legacy scripts.

  1. conda update conda
  2. conda update anaconda

right now, the anaconda_prompt displays (base) C:\> when opened.

Rene Duchamp
  • 2,429
  • 2
  • 21
  • 29
  • Possible duplicate of [How to install 2 Anacondas (Python 2 and 3) on Mac OS](https://stackoverflow.com/questions/24405561/how-to-install-2-anacondas-python-2-and-3-on-mac-os) – vasia Aug 14 '18 at 15:36

1 Answers1

4

If you have some legacy projects that run on Python 2.7, that does not mean that you should have Anaconda 2 and 3 installed at the same time. Although this shouldn't cause any significant problems, it can be confusing and irritating to deal with environment variables and whatnot. (I may be wrong on this - there may be compatibility problems that I am unaware of!)

Instead, what I recommend is to install only Anaconda 3 and use conda's virtual environments. Virtual environments allow you to create an independent project environment with different pip packages, package versions, and most of all different Python versions. Anaconda supports virtual environments in conda, and you can easily make a Python 2.7 environment in the console with

conda create -n Python27 python=2.7

This will create a virtual environment with the name of Python27 that runs Python 2.7, and you can run and manage all your legacy projects within this environment. That includes running files, Spyder, Jupyter Notebook, etc. You can activate this environment with:

source activate Python27

Even if you find a workaround for your problem with different Anaconda distributions for now, ultimately you will be using virtual environments. So I recommend doing so right now!

EDIT: The official Anaconda documentation also explicitly mentions conda environments as a way to install multiple versions of Python.

Shawn Lee
  • 143
  • 1
  • 9
  • 1
    Don’t the Anaconda docs have essentially the identical recommendation in them? If so, finding the link and adding it to your answer would make it even better, because now you’re not just giving your informed but still subjective recommendation and backing it up with good reasons, you’re also backing it up with official documentation. – abarnert Aug 14 '18 at 16:31
  • @abarnert It seems like the docs do in fact recommend that :D I've edited accordingly. Thanks! – Shawn Lee Aug 15 '18 at 02:47