47

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?

Sam
  • 11,799
  • 9
  • 49
  • 68
Jeevan
  • 740
  • 2
  • 7
  • 15
  • 3
    Accept the answer whichever is applicable to you. Because it will help the reader for quick review. – David Apr 18 '18 at 10:27

8 Answers8

54

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

MSeifert
  • 145,886
  • 38
  • 333
  • 352
25

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.

M.Hossein Rahimi
  • 557
  • 2
  • 9
  • 20
12

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)

Dan
  • 487
  • 5
  • 19
  • 2
    This is not fully for this question, but it's a good info. Still working with Spyder 3.2+ ? – Sandburg Jan 24 '19 at 10:48
  • On 6/28/2022, I am trying to follow this advice. I left my PC on overnight while it was solving environment in response to "conda install spyder". I already have spyder installed to work with py10. I closed the Anaconda Prompt and am trying now to do it in a new Anaconda Prompt. Any suggestions would be appreciated. – Steve Maguire Jun 28 '22 at 13:26
5

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.

Francisco C
  • 193
  • 3
  • 7
4

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.

cmpgamer
  • 352
  • 1
  • 7
4

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

cloudscomputes
  • 1,278
  • 13
  • 19
4
  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

Han
  • 41
  • 1
-2

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

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
tonigo
  • 1
  • That's to update Python, it's not really the same as using a different version while also keeping the current one. – AMC May 12 '21 at 14:44