使用uv导入嵌套模块时遇到ModuleNotFoundError及Python版本兼容问题求助
使用uv导入嵌套模块时遇到ModuleNotFoundError及Python版本兼容问题求助
我正在用uv管理一个项目,项目的文件结构如下:
- src - app.py - constants.py - notebooks - testing.ipynb - pyproject.toml
我的pyproject.toml文件内容为:
[project] name = "benchmark-extractor" version = "0.1.0" description = "Add your description here" readme = "README.md" requires-python = ">=3.13" dependencies = [ "anthropic>=0.42.0", "ipykernel>=6.29.5", "markitdown>=0.0.1a3", "pandera>=0.22.1", "tabula-py>=2.10.0", ]
出于实验需求,我想把app.py和constants.py导入到notebooks/testing.ipynb中,但直接用import src.app这种方式尝试时,会出现*"ModuleNotFoundError"*错误。
我原本打算用uv pip install -e .的方法来解决这个问题,但运行这个命令后,却收到了如下错误提示:
ERROR: Package 'benchmark-extractor' requires a different Python: 3.11.3 not in '>=3.13'
备注:内容来源于stack exchange,提问作者Nik
相关产品推荐
相关产品推荐

