7

I have virtual environment set on my system (actually virtualenvwrapper). I would like to direct org babel to use a specific environment in a single code block or on the whole buffer. How can I do it?

6

I believe I found the solution.

  1. Install virtualenvwrapper
  2. Run the setup:

    (require 'virtualenvwrapper)
    (venv-initialize-interactive-shells) ;; if you want interactive shell support
    (venv-initialize-eshell) ;; if you want eshell support
    (setq venv-location "/path/to/your/virtualenvs/")
    
  3. Finally, workon the desired virtual environment. Then you can run code block and use the desired interpreter.

  • Thanks for sharing this with us. Would be useful as future reference, when someone stumbles upon same issue. – ReneFroger May 20 '15 at 14:50
  • For future reference, this only works for me if I use a :session – ibizaman Jan 12 '18 at 19:28

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.