Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switch between spyder for python 2 and 3

From what I have learnt in the documentation it states that you can easily switch between 2 python environments by just creating a new variable using command prompt

"conda create -n python34 python=3.4 anaconda" if i already have python 2.7 installed.

An environment named python 34 is created and we can activate it using "activate python 34" But all this happens like executing the above commands happens in my windows command prompt. I want to switch between python versions in spyder IDE, How to do this?

like image 585
Prudhvi Charan Avatar asked Mar 14 '17 14:03

Prudhvi Charan


People also ask

How do I switch between pythons in Spyder?

To work with an existing environment in Spyder, you need to change Spyder's default Python interpreter. To do so, click the name of the current environment in the status bar, and then click Change default environment in Preferences.

Can you run Python 2 and 3 at the same time?

We can have both Python 2 and Python 3 installed on any Windows or Linux device. We can either create different environments on different IDEs to use the versions separately or use the following ways to run them using the command prompt.


1 Answers

Spyder is launched from the environment that you're using.

So if you want to use python 3 in Spyder then you activate python34 (or whatever you named the environment with Python 3) then run spyder.

If you want to use python 2 in Spyder then you deactivate the python3 environment (or activate an environment in which you installed Python 2) then run spyder.

I do not believe that you can change environments once Spyder is launched.

N.B. you may need to install Spyder in each environment, depending on your set up, by first activating the environment then using conda install spyder.

like image 67
Ari Cooper-Davis Avatar answered Sep 27 '22 21:09

Ari Cooper-Davis