1

几个月前我已经安装了 emacs-jedi,它运行得非常好。在没有 python 项目的一段时间后,我回来了(更新了 emacs 26 并重新安装了 emacs-jedi),但我遇到了一个问题:

当我刚启动 emacs 时,jedi 工作正常。但是我一跑M-x pyvenv-workon some_python3_venv,绝地就停止工作。我得到了可怕的错误(当然我尝试过jedi:install-server):

Error (jedi):
================================
Failed to start Jedi EPC server.
================================

*** EPC Error ***
Server may raise an error. Use "M-x epc:pop-to-last-server-process-buffer RET" to see full traceback:
No handlers could be found for logger "jediepcserver"


*** EPC Server Output (last 10 lines) ***
No handlers could be found for logger "jediepcserver"


*** EPC Server Config ***
Server arguments: ("/home/me/.emacs.d/.python-environments/default/bin/jediepcserver" "--virtual-env" "/home/me/.virtualenvs/some_project")
Actual command: /home/me/.emacs.d/.python-environments/default/bin/jediepcserver
VIRTUAL_ENV envvar: "/home/me/.virtualenvs/some_project"

*** jedi-mode is disabled in #<buffer algorithms.py> ***
Fix the problem and re-enable it.

*** You may need to run "M-x jedi:install-server". ***
This could solve the problem especially if you haven't run the command yet
since Jedi.el installation or update and if the server complains about
Python module imports.

在“重新开始后良好”的情况下,jedi:show-setup-info告诉我:

;; Emacs Lisp version:
(:emacs-version "26.1" :jedi-version "0.2.7" :python-environment-version "0.0.2alpha0")
;; Python version:
((:version "2.7.16 (default, Apr  6 2019, 01:42:57) \n[GCC 8.3.0]" :name "sys" :file nil)
 (:version "0.13.3" :name "jedi" :file "/home/me/.emacs.d/.python-environments/default/local/lib/python2.7/site-packages/jedi/__init__.pyc")
 (:version "0.0.5" :name "epc" :file "/home/me/.emacs.d/.python-environments/default/local/lib/python2.7/site-packages/epc/__init__.pyc")
 (:version "0.0.3" :name "sexpdata" :file "/home/me/.emacs.d/.python-environments/default/local/lib/python2.7/site-packages/sexpdata.pyc"))
;; Command line:
(:virtualenv "/usr/bin/virtualenv" :virtualenv-version "15.1.0\n")
;; Customization:
((jedi:complete-on-dot)
 (jedi:doc-display-buffer . display-buffer)
 (jedi:doc-hook view-mode)
 (jedi:doc-mode . rst-mode)
 (jedi:environment-root)
 (jedi:environment-virtualenv)
 (jedi:get-in-function-call-delay . 1000)
 (jedi:get-in-function-call-timeout . 3000)
 (jedi:goto-definition-config
  (nil nil nil)
  (t nil nil)
  (nil definition nil)
  (t definition nil)
  (nil nil t)
  (t nil t)
  (nil definition t)
  (t definition t))
 (jedi:goto-definition-marker-ring-length . 16)
 (jedi:imenu-create-index-function . jedi:create-nested-imenu-index)
 (jedi:import-python-el-settings . t)
 (jedi:install-imenu)
 (jedi:install-python-jedi-dev-command "pip" "install" "--upgrade" "git+https://github.com/davidhalter/jedi.git@master#egg=jedi")
 (jedi:key-complete .
                    [C-tab])
 (jedi:key-goto-definition .
                           [67108910])
 (jedi:key-goto-definition-pop-marker .
                                      [67108908])
 (jedi:key-related-names . "r")
 (jedi:key-show-doc . "d")
 (jedi:server-args)
 (jedi:server-command "/home/me/.emacs.d/.python-environments/default/bin/jediepcserver")
 (jedi:setup-keys)
 (jedi:tooltip-method)
 (jedi:use-shortcuts)
 (python-environment-default-root-name . "default")
 (python-environment-directory . "~/.emacs.d/.python-environments")
 (python-environment-virtualenv "virtualenv" "--system-site-packages" "--quiet"))

运行后M-x pyvenv-workon,我得到几乎相同的输出,但该部分;; Python version:显示一些错误:

;; Emacs Lisp version:
(:emacs-version "26.1" :jedi-version "0.2.7" :python-environment-version "0.0.2alpha0")
;; Python version:
nil
;; EPC error:
(:get-epc-error
 (wrong-type-argument epc:manager nil))

我需要做什么才能将 emacs-jedi 与我的项目所需的 virtualenv 一起运行?我尝试自定义jedi:server-args,但这没有帮助。

4

0 回答 0