I have anaconda environments for python2 and python3 as I have code written in the different versions

In spacemacs (with python layer installed), when I open ipython (SPC m s i) it starts with my default environment (python 3)

Is there a way to choose which version of python I run my code with? I've tried opening a shell with activate python2 to activate my other environment, but ipython in emacs still opens with my default

One way I've found is to activate the environment is SPC m V a then navigate to the directory where the venv is, but this is quite tedious as the python script and venv are often on different drives so it takes a fair bit of typing/tabbing to get to the venv directory

Is there a quicker way?

1 Answer 1


Basically, this is a duplicate of this question. Reproducing the proposed behavior with spacemacs, I changed my user-init to:

(defun dotspacemacs/user-init ()
  (setenv "WORKON_HOME" "/home/<username>/.local/bin/anaconda3/envs")

After reloading my .spacemacs file with SPC f e R, I'm immediately able to use , V w and select environments from my anaconda installation.

  • 1
    , v w for me.
    – HappyFace
    Aug 19, 2019 at 18:49
  • Once I switch conda environments, If I do SPC m c c to run my script, it still uses my base environment. Any ideas how to run with the selected environment?
    – Austin
    Jan 30, 2020 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.