OS: Arch Linux
I follow the document and I enter pip install 'python-language-server[all]' --user
in the terminal at last. After opening a python file in Emacs, lsp-mode promat me "command pyls is not present on the path" and no any completion list. But I can run it in the terminal by entering pyls
. Here is my init-lsp.el.
(use-package lsp-mode
:init (setq lsp-keymap-prefix "C-c l")
:hook ((python-mode . lsp-deferred))
:commands (lsp lsp-deferred))
(use-package lsp-ivy :commands lsp-ivy-workspace-symbol)
(use-package lsp-treemacs :commands lsp-treemacs-errors-list)
(provide 'init-lsp)
I seem to have solved it. Emacs cannot find the executable for pyls because the directory of this file is not in the environment variable of Emacs. Execute M-x setenv RET PATH
in Emacs, and then set the environment variable. I filled in /home/liu/.local/bin