Jeevan
Jeevan

Reputation: 740

How to change python version in anaconda spyder

I am using 3.6 Python version in anaconda spyder on my mac. But I want to change it to Python 2.7.

Can any one tell me how to do that?

Upvotes: 47

Views: 254264

Answers (8)

tonigo
tonigo

Reputation: 1

In Anaconda, click on "Environments", scroll down to the software package(s) you need to update, and click on the update arrow.

Anaconda software package updates

Upvotes: -2

M.Hossein Rahimi
M.Hossein Rahimi

Reputation: 617

First, you have to run below codes in Anaconda prompt,

conda create -n py27 python=2.7  #for version 2.7
activate py27

conda create -n py36 python=3.6  #for version 3.6
activate py36

Then, you have to open Anaconda navigator and, enter image description here The button might say "install" instead of Launch. After the installation, which takes a few moments, It will be ready to launch.

Thank you, @cloudscomputes and @Francisco Camargo.

Upvotes: 25

Han
Han

Reputation: 41

  1. Set python3 as a main version in the terminal: ln -sf python3 /usr/bin/python

  2. Install pip3: apt-get install python3-pip

  3. Update spyder: pip install -U spyder

Enjoy

Upvotes: 4

cloudscomputes
cloudscomputes

Reputation: 1474

If you are using anaconda to go into python environment you should have build up different environment for different python version

The following scripts may help you build up a new environment(running in anaconda prompt)

conda create -n py27 python=2.7  #for version 2.7
activate py27

conda create -n py36 python=3.6  #for version 3.6
activate py36

you may leave the environment back to your global env by typing
deactivate py27 
or 
deactivate py36 

and then you can either switch to different environment using your anaconda UI with @Francisco Camargo 's answer

or you can stick to anaconda prompt using @Dan 's answer

Upvotes: 4

Francisco C
Francisco C

Reputation: 381

You can launch the correct version of Spyder by launching from Ananconda's Navigator. From the dropdown, switch to your desired environment and then press the launch Spyder button. You should be able to check the results right away.

Upvotes: 5

Dan
Dan

Reputation: 567

If you want to keep python 3, you can follow these directions to create a python 2.7 environment, called py27.

Then you just need to activate py27:

$ conda activate py27

Then you can install spyder on this environment, e.g.:

$ conda install spyder

Then you can start spyder from the command line or navigate to 2.7 version of spyder.exe below the envs directory (e.g. C:\ProgramData\Anaconda3\envs\py27\Scripts)

Upvotes: 12

MSeifert
MSeifert

Reputation: 152577

You can open the preferences (multiple options):

  • keyboard shortcut Ctrl + Alt + Shift + P
  • Tools -> Preferences

And depending on the Spyder version you can change the interpreter in the Python interpreter section (Spyder 3.x):

enter image description here

or in the advanced Console section (Spyder 2.x):

enter image description here

Upvotes: 54

cmpgamer
cmpgamer

Reputation: 352

In Preferences, select Python Interpreter

Under Python Interpreter, change from "Default" to "Use the following Python interpreter"

The path there should be the default Python executable. Find your Python 2.7 executable and use that.

Upvotes: 4

Related Questions