无法用诗歌指定父母文件夹中的依赖性

发布于 2025-01-25 06:08:28 字数 1363 浏览 1 评论 0原文

我有以下文件层次结构:

./
├── abc
│   ├── pyproject.toml
│   ├── main.py
│   └── xyz 
│      ├── __init__.py
│      └── other.py
└── common-lib
    ├── pyproject.toml
    └── common
        ├── __init__.py
        └── lib1.py

pyproject.toml abc的文件中,我似乎无法将common-lib作为依赖关系我尝试。一个例子如下。我检查了许多类似的问题。

[tool.poetry]
packages = [{ include = "common", from = "common-lib" }]
[tool.poetry.dependencies]
common-lib = { path = "../common-lib", develop=true}

我收到以下错误。

Updating dependencies
Resolving dependencies...

Package operations: 1 install, 0 updates, 0 removals

  • Installing common-lib (0.1.0 somePath/common-lib)

  ModuleOrPackageNotFound

  No file/folder found for package common-lib

  at ~\AppData\Roaming\Python\Python310\site-packages\poetry\core\masonry\utils\module.py:63 in __init__
       59│                             "from": str(src.relative_to(self._path)),
       60│                         }
       61│                     ]
       62│                 else:
    →  63│                     raise ModuleOrPackageNotFound(
       64│                         "No file/folder found for package {}".format(name)
       65│                     )
       66│
       67│         for package in packages:

您能帮我解决这个问题吗?

I have the following file hierarchy:

./
├── abc
│   ├── pyproject.toml
│   ├── main.py
│   └── xyz 
│      ├── __init__.py
│      └── other.py
└── common-lib
    ├── pyproject.toml
    └── common
        ├── __init__.py
        └── lib1.py

In pyproject.toml file of abc, I cannot seem to add common-lib as a dependency no matter how I try. One example is as below. I checked many similar questions.

[tool.poetry]
packages = [{ include = "common", from = "common-lib" }]
[tool.poetry.dependencies]
common-lib = { path = "../common-lib", develop=true}

I receive the following error.

Updating dependencies
Resolving dependencies...

Package operations: 1 install, 0 updates, 0 removals

  • Installing common-lib (0.1.0 somePath/common-lib)

  ModuleOrPackageNotFound

  No file/folder found for package common-lib

  at ~\AppData\Roaming\Python\Python310\site-packages\poetry\core\masonry\utils\module.py:63 in __init__
       59│                             "from": str(src.relative_to(self._path)),
       60│                         }
       61│                     ]
       62│                 else:
    →  63│                     raise ModuleOrPackageNotFound(
       64│                         "No file/folder found for package {}".format(name)
       65│                     )
       66│
       67│         for package in packages:

Could you help me solving this problem?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

渔村楼浪 2025-02-01 06:08:28

我在pyproject.toml中设法通过以下设置解决了问题。

[tool.poetry]
packages = [{ include = "common", from = "../common-lib"}]
[tool.poetry.dependencies]
common-lib = "../common-lib"

I managed to solve the issue with the following settings in the pyproject.toml.

[tool.poetry]
packages = [{ include = "common", from = "../common-lib"}]
[tool.poetry.dependencies]
common-lib = "../common-lib"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文