当我试图在conda环境中运行一个脚本时,它会给我一个ModuleNotFound错误
(ldm) C:\Users\Иван\Documents\git\stable-diffusion>python scripts/txt2img.py --prompt "a photograph of an astronaut in space" --plms
Traceback (most recent call last):
File "scripts/txt2img.py", line 17, in <module>
from ldm.util import instantiate_from_config
ModuleNotFoundError: No module named 'ldm'下面是txt2img.py的台词。
from ldm.util import instantiate_from_config
from ldm.models.diffusion.ddim import DDIMSampler
from ldm.models.diffusion.plms import PLMSSampler但要点是:
中没有编译器的抱怨。
我能确定的是:
txt2img.py's目录是C:\Users\Иван\Documents\git\stable-diffusion\scripts\txt2img.py,ldm的目录是C:\Users\Иван\Documents\git\stable-diffusion\ldm
f 223)没有出现问题。
有办法解决这个问题吗?
发布于 2022-09-02 09:38:33
通过输入以下内容解决了这个问题:
pip install -e .我认为它只是安装了项目文件夹中的所有包。
发布于 2022-09-01 08:34:24
作为一种快速解决方案,请尝试以下方法:
cd C:\Users\Иван\Documents\git\stable-diffusion
C:\Users\Иван\Documents\git\stable-diffusion> python scripts\txt2img.py --prompt "a photograph of an astronaut in space" --plms在VSCode中,执行以下操作:
将'C:\Users\Иван\Documents\git\stable-diffusion‘添加到工作区
ctrl + ~)
)
python scripts\txt2img.py --prompt "a photograph of an astronaut in space" --plms基于注释的更新:
您需要在所有文件夹中添加一个空的__init__.py。参考here
https://stackoverflow.com/questions/73565858
复制相似问题