5

I install the python3.5 and python 2.7 in anaconda. the anaconda manager python version and package is convenvient. activate pyx.x in win10's cmd. In emacs's python-mode, c-c c-p (start interpreter) only open the default python version. how switch python version ?

1 Answer 1

9

You didn't seem to explain your self much so I'm going to try and guess what you want.

You want to be able to switch conda python versions and conda virtual environments depending on what files you're editing. I recently set this up using the pyvenv package. In my config file I have:

(use-package pyvenv
        :ensure t
        :init
        (setenv "WORKON_HOME" "/home/NAME/anaconda/envs")
        (pyvenv-mode 1)
        (pyvenv-tracking-mode 1))

Change the "WORKON_HOME" directory to point to the directory with your virtual environments.

Then in your project directory. Place a file called .dir-locals.el in that file place: ((nil . ((pyvenv-workon . "ENV_NAME")))) where ENV_NAME should be replaced by your virtual-environments name.

Your project tree should look like:

-Project
  -projectfile_1.py
  -projectfile_2.py
  -.dir-locals.el

If that doesn't help let me know

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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