pip包安装后运行失败(使用诗歌)

发布于 2025-01-17 00:18:55 字数 677 浏览 1 评论 0原文

我正在使用诗歌我的项目有一棵树:
https://i.sstatic.net/PSJfI.png

我的代码中有这样的路径:

SPACESHIP_FRAMES = (
    'space_game/frames/rocket/rocket_frame_1.txt',
    'space_game/frames/rocket/rocket_frame_2.txt',
)

当我将程序作为诗歌脚本运行时,一切正常:space-game = "space_game.game:main" 和简单的 python 脚本。

但!当我尝试在将游戏安装为 pip 包后运行 space-game 时,我看到:

FileNotFoundError: [Errno 2] No such file or directory: 'space_game/frames/rocket/rocket_frame_1.txt'

How should I edit path to txt or pyproject.toml?

我尝试了不同的方法来写入 txt 文件的路径,但没有任何帮助。

I am using poetry There is a tree of my project:
https://i.sstatic.net/PSJfI.png

I have such paths in my code:

SPACESHIP_FRAMES = (
    'space_game/frames/rocket/rocket_frame_1.txt',
    'space_game/frames/rocket/rocket_frame_2.txt',
)

Everything is working when I run my programm both as poetry script: space-game = "space_game.game:main" and as simple python script.

But! When I try to run space-game after installation game as pip package I see:

FileNotFoundError: [Errno 2] No such file or directory: 'space_game/frames/rocket/rocket_frame_1.txt'

How should I modify path to txt or pyproject.toml?

I tried different ways to write paths to txt files but nothing helped.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文