You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Emacs Jedi插件执行jedi:install-server失败,sexpdata安装报错求助

问题:Emacs Jedi插件配置时sexpdata安装失败(EndeavourOS环境)

我是Python和Emacs新手,尝试通过MELPA配置Jedi插件,但运行pip时sexpdata出现问题,推测根源在sexpdata。我尝试在Jedi自带的pip中安装它,却在构建wheel时出错;不过能在venv中安装,但不确定如何让Jedi使用该虚拟环境,也不确定能否解决问题。我使用EndeavourOS,在MacBook上安装无异常。我已删除~/.emacs/elpa/jedi*文件夹并重新安装插件,但问题依旧,恳请提供解决建议!


执行jedi:install:server时的输出:

Running: pip install --upgrade /home/name/.emacs.d/elpa/jedi-core-20210503.1315/...Done
deferred error : (error "Deferred process exited abnormally:
  command: /home/name/.emacs.d/.python-environments/default/bin/pip
  exit status: exit 1
  event: exited abnormally with code 1

note: This error originates from a subprocess, and is likely not a problem with pip.

pip安装sexpdata时的错误:

Collecting sexpdata>=0.0.3 (from epc>=0.0.4->jediepcserver==0.3.0)
  Using cached sexpdata-1.0.1.tar.gz (8.6 kB)
  Installing build dependencies ... [?25l- \\ | / - done
[?25h  Getting requirements to build wheel ... [?25l- error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [78 lines of output]

关键错误片段:

File "/tmp/pip-build-env-fhs0pp5v/overlay/lib/python3.11/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 183, in _license
          _set_config(dist, "license", val["text"])
                                       ~~~^^^^^^^^
      KeyError: 'text'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

解决建议:

  • 指定sexpdata兼容版本
    错误来自sexpdata 1.0.1与Python 3.11/新版setuptools的兼容性问题,直接安装旧版本规避:
    先激活Jedi自带的虚拟环境:

    source /home/name/.emacs.d/.python-environments/default/bin/activate
    

    再安装指定版本:

    pip install sexpdata==0.0.3
    

    完成后重新运行jedi:install:server。

  • 让Jedi使用已配置好的venv
    在Emacs配置文件(~/.emacs或~/.emacs.d/init.el)中添加以下代码,指定Jedi使用你能正常安装sexpdata的虚拟环境:

    ;; 指定虚拟环境根目录
    (setq jedi:environment-root "/path/to/your/venv")
    ;; 或直接指定Python解释器路径
    (setq jedi:server-command '("/path/to/your/venv/bin/python" "-m" "jediepcserver"))
    

    保存配置后重启Emacs,再尝试安装Jedi server。

  • 降级setuptools版本
    激活Jedi的虚拟环境后,降级setuptools到兼容版本:

    pip install setuptools<60.0.0
    

    再重新安装sexpdata和jediepcserver。

  • 切换系统Python版本
    EndeavourOS默认可能使用较新的Python 3.11,而MacBook上的版本更低。可以尝试安装Python 3.10,然后让Jedi使用该版本:

    (setq jedi:server-command '("/usr/bin/python3.10" "-m" "jediepcserver"))
    

内容的提问来源于stack exchange,提问作者Neiko

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 20:00:30