문제

When I use 'el.get' to install 'jedi', I get message:

'/bin/sh: virtualenv: command not found make: * [env/bin/activate] Error 127'

But I have already installed 'virtualenv', and when I type 'virtualenv' in the terminal, I actually get some description of usage of 'virtualenv'.

On the other hand, when I tried 'virtualenv' command in the shell-mode in emacs, it told me that such command cannot be found. I think this is where the bug lies.

Any idea on what is going on here?

도움이 되었습니까?

해결책

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))

다른 팁

exec-path-from-shell is another way to push environment variables into Emacs.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top