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

Poetry执行install报错not enough values to unpack及命令异常求助

问题描述

无packages配置时的状态

项目根目录下的pyproject.toml内容如下:

[tool.poetry]
name = "controller_poc"
version = "0.1.0"
description = "Controller (API) POC"
license = "MIT"
authors = ["Felipe Freitas"]
readme = "README.md"
repository = "https://github.com/felipefreitassilva/..."
keywords = ["Controller", "POC"]

[tool.poetry.dependencies]
python = "^3.9"
fastapi = "0.103.1"
pylint = "2.17.6"
pydantic = "2.3.0"
uvicorn = "0.23.2"
python-multipart = "0.0.6"
httpx = "0.25.0"

sqlalchemy = {version = "2.0.20", extras = ["sqlite"]}
sqlalchemy_utils = "0.41.1"
pymysql = "1.0.2"

autopep8 = "2.0.4"
pytest = "7.4.2"
pytest-cov = "4.1.0"

[tool.poetry.scripts]
start = "app.main:start"
test = "pytest"
lint = "autopep8 --in-place --recursive ."

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

执行poetry install无异常:

C:\Users\Felipe\Controller_POC> poetry install
Skipping virtualenv creation, as specified in config file.
Installing dependencies from lock file

No dependencies to install or update

但执行启动命令poetry run start报错:

C:\Users\Felipe\Controller_POC> poetry run start
Skipping virtualenv creation, as specified in config file.

No file/folder found for package controller-poc

启动脚本本身可独立正常运行,代码如下:

def start():
    """
    Run the application with uvicorn
    """
    from uvicorn import run
    run('app.main:app',
        reload=True,
        workers=1,
        host=settings.API_HOST,
        port=settings.API_PORT)


if __name__ == "__main__":
    start()

添加packages配置后的矛盾现象

按照Poetry文档说明,在[tool.poetry]段添加packages=[{ include="app" }]后,执行poetry install出现新错误:

C:\Users\Felipe\Controller_POC> poetry install
Skipping virtualenv creation, as specified in config file.
Installing dependencies from lock file

No dependencies to install or update

Installing the current project: controller_poc (0.1.0)

not enough values to unpack (expected 2, got 1)

但此时poetry run start却能正常启动服务:

C:\Users\Felipe\Controller_POC> poetry run start
Skipping virtualenv creation, as specified in config file.
INFO:     Will watch for changes in these directories: ['C:\\Users\\Felipe\\Controller_POC']
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [3336] using StatReload
INFO:     Started server process [7372]
INFO:     Waiting for application startup.
INFO:     Application startup complete.

求助需求

无法理解上述矛盾现象,已查阅相关论坛和文档但未找到原因。作为Python新手,考虑更换工具,了解到poethepoet,但不确定其安全性和是否适配当前需求,恳请提供解决方向。


内容的提问来源于stack exchange,提问作者Felipe Freitas Silva

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.08 22:47:22