使用诗歌运行Python模块
我的 Makefile
中有一个命令,如下所示
run/webserver:
PYTHONPATH=src venv/bin/python -m api
,项目结构如下所示
project/
src/
api/
__init__.py
__main__.py
tests/
Makefile
我使用基本的 pip
和 requirements.txt
文件,但是决定转向诗歌。
我将 Makefile
更新为此
run/webserver:
poetry shell
poetry run python -m api
并且 pyproject.toml
包含此配置诗歌
[tool.poetry]
name = "project"
description = "project"
version = "1.20.0"
homepage = "https://"
repository = "https://"
documentation = "https://"
authors = [""]
packages = [
{ include="src", from="." },
]
但是当我尝试运行该命令时
make run/webserver
它失败了,并显示
No module named api
什么可能是问题?
I have a command in my Makefile
that looks like this
run/webserver:
PYTHONPATH=src venv/bin/python -m api
and project structure that looks like this
project/
src/
api/
__init__.py
__main__.py
tests/
Makefile
I used basic pip
with requirements.txt
file, but decided to migrate to poetry.
I updated Makefile
to this
run/webserver:
poetry shell
poetry run python -m api
And pyproject.toml
contains this configuration poetry
[tool.poetry]
name = "project"
description = "project"
version = "1.20.0"
homepage = "https://"
repository = "https://"
documentation = "https://"
authors = [""]
packages = [
{ include="src", from="." },
]
But when I try to run the command
make run/webserver
It fails with
No module named api
What might be the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
包装参数通常包括:
https://python-poetry.org/docs/pyprotry.org/pyproject/pyproject/pyproject/pyproject/pyproject/pyproject /#软件包
The packages argument usually includes the name:
https://python-poetry.org/docs/pyproject/#packages