我是 python 新手,我有点迷路了,我在生菜中有一个小黄瓜项目,但我发现我正在使用行为创建一个项目。
我创建了这些文件和文件夹:
features
features > steps
features > steps > example.py
features > environment.pys
features > example.feature
然后,当我运行它时,我发现它没有所需的依赖项,因为我收到了这个错误:
ModuleNotFoundError: No module named 'pynput'
所以,我寻找了一个 python 的构建工具,发现 pybuilder 似乎是一个不错的选择,所以我创建了一个这样的build.py:
from pybuilder.core import init, use_plugin, task
from subprocess import call
use_plugin("python.core")
use_plugin("python.install_dependencies")
default_task = "behave"
@init
def initialize(project):
project.depends_on("pynput")
@task
def behave(project):
call(["behave"])
但问题仍然存在,它没有选择对“pynput”的依赖,我仍然遇到同样的错误,我发现其他站点使用文件 requirements.txt 来代替依赖,我不确定它是否可能但我更愿意将 pybuild 结构用于项目,这就是没有任何工作的原因,如下所示:
src
src > test
src > test > python
src > test > python > example.py
src > test > features
src > test > features > example.feature
这可能吗?还是我应该使用不同的构建工具来表现?为什么我无法导入依赖项?
谢谢