Domanda

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?

È stato utile?

Soluzione

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

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top