1

I am using Anaconda 3 on Windows and added it to PATH. I have created an environment in which I have installed Python 2. I can change to Py2 environment with

activate ENV_NAME

This change is limited to the current terminal only. Is there any in-built way to permanently change active Python so that it is accessible throughout the whole system ? I want this because I have some program that needs Python 2 and it looks in the PATH variable for python installation and so catches Python 3.

Avi
  • 1,341
  • 1
  • 18
  • 28

2 Answers2

0

You should be able to simply update/install the python in your root environment. Try conda install python=2.7.

You could also add the Python in your Py2 environment first in your PATH.

Take a look at this question for more details.

Community
  • 1
  • 1
Paul
  • 5,473
  • 1
  • 30
  • 37
  • I might have been unclear. I don't want to remove python 3 from root environment. I just want to use Python 2 as root for some time, then switch back. – Avi Mar 09 '16 at 04:25
0

Changing the system wide python is a matter of which python can be found through the PATH variable.

So I can think of 2 alternatives:

  1. You switch the python version back and forth in your root environment like paul suggested.
  2. You manipulate your PATH variable to point to the desired python.

Notice that the second alternative can be pretty fragile since if your PATH is not set correctly you will end running the wrong python version on your programs.

Maybe you could create a .bat file which would activate the correct environment and launch your "python 3" software.

Community
  • 1
  • 1
Gustavo Muenz
  • 9,278
  • 7
  • 40
  • 42