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

在机构电脑Jupyter Notebook安装medspacy遇python setup.py egg_info错误

问题:Windows下安装medspacy时leveldb编译失败

在机构台式机的Anaconda环境中,通过Jupyter Notebook执行%pip install medspacy安装medspacy时出现报错,怀疑与非个人电脑权限有关,重装setuptools后问题依旧。报错核心为leveldb无法在Windows环境编译,具体输出如下:

Collecting medspacy
  Using cached medspacy-1.0.0-py3-none-any.whl (146 kB)
Collecting spacy>=3.4.1
  Using cached spacy-3.4.3-cp39-cp39-win_amd64.whl (11.9 MB)
Collecting pysbd==0.3.4
  Using cached pysbd-0.3.4-py3-none-any.whl (71 kB)
Collecting PyRuSH>=1.0.6
  Using cached PyRuSH-1.0.8-cp39-cp39-win_amd64.whl (64 kB)
Collecting medspacy-quickumls==2.6
  Using cached medspacy_quickumls-2.6-py3-none-any.whl (31 kB)
Requirement already satisfied: jsonschema in c:\users\jch97\anaconda3\lib\site-packages (from medspacy) (4.16.0)
Collecting unqlite>=0.8.1
  Using cached unqlite-0.9.3.tar.gz (575 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting leveldb>=0.193
  Using cached leveldb-0.201.tar.gz (236 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
Note: you may need to restart the kernel to use updated packages.

error: subprocess-exited-with-error
  
  python setup.py egg_info did not run successfully.
  exit code: 1
  
  [1 lines of output]
  Don't know how to compile leveldb for Windows!
  [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Encountered error while generating package metadata.

See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
解决方法

方法1:用conda安装(推荐)

conda仓库提供预编译的medspacy包,无需手动编译依赖:

  • 打开Anaconda Prompt,激活你的Python环境:conda activate 你的环境名称
  • 执行安装命令:conda install -c conda-forge medspacy

方法2:安装medspacy核心包(跳过QuickUMLS)

如果不需要QuickUMLS功能,可以只安装medspacy核心组件,避开leveldb依赖:

%pip install medspacy-core

后续可按需单独安装其他组件(如medspacy-io、medspacy-visualizer),这些组件均不依赖leveldb。

方法3:手动安装预编译的leveldb wheel

若必须完整安装medspacy:

  1. 下载适配你Python版本和Windows系统的leveldb预编译wheel文件
  2. 先安装该wheel:%pip install 下载的wheel文件路径
  3. 再执行%pip install medspacy

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.10 03:01:01