4

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?

6

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.

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.