简体   繁体   中英

ImportError: cannot import name 'YamlModel' from 'pydantic_yaml'

I am working at blender script, where I want to use YAML. So I try to import it:

from pydantic import BaseModel
from pydantic_yaml import YamlModel

But when I run my script, this error will occure:

ImportError: cannot import name 'YamlModel' from 'pydantic_yaml' (C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\lib\site-packages\pydantic_yaml\__init__.py)

I have installed pydantic and pydantic_yaml on both Pythons (Blender one and the common one), if they wouldn't be installed, there would be different error. I tried googling, but google had very few results for this problem. Also, when I open that __init__.py file, there is clearly YamlModel . Thank you for any kind of help.

I found the same error and it is related how pydantic-yaml got installed.

There is a bug in the package. you need to install optional dependencies as well (so called extras).

pip install pedantic-yaml[pyyaml,ruamel]

or manually install pyyaml ruamel please make sure that that Taumel version is <=0.18

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM