You need to find where the virtualenv
is installed (for example, by using the which virtualenv
in the terminal), and add this directory to PATH
inside emacs. You can do this with following code in your emacs init file:
(setenv "PATH" (concat (getenv "PATH") ":" "path-to-virtual-env"))
(add-to-list 'exec-path "path-to-virtual-env")
I personally use the following code to keep the PATH
in Emacs synced with PATH
in shell:
(defun set-exec-path-from-shell-PATH ()
(let ((path-from-shell (shell-command-to-string "$SHELL -c 'echo $PATH'")))
(setenv "PATH" path-from-shell)
(setq exec-path (split-string path-from-shell path-separator))))
(when window-system (set-exec-path-from-shell-PATH))