FileCodeBox icon indicating copy to clipboard operation
FileCodeBox copied to clipboard

手动部署出现pydantic.errors

Open stphi opened this issue 11 months ago • 3 comments

OS:ubuntu 24.04 & win11 python 3.13

手动部署2.2版本,安装相关依赖后,启动项目始终提示: pydantic.errors.PydanticUserError: model_config cannot be used as a model field name. Use model_config for model configuration.

依赖安装情况: 1、通过ubuntu中的宝塔面板部署,python版本:3.13、3.13.2均出现以上错误,查看默认安装了 pydantic 2.11.1,无法安装2.4.0 2、在windows中部署,也出现以上错误。 pydantic.errors.PydanticUserError: model_config cannot be used as a model field name. Use model_config for model configuration. For further information visit https://errors.pydantic.dev/2.11/u/model-config-invalid-field-name

stphi avatar Apr 02 '25 06:04 stphi

降低python版本试试

vastsa avatar Apr 02 '25 08:04 vastsa

C:\Users\Administrator\Desktop\FileCodeBox-master.venv\Lib\site-packages\pydantic_internal_config.py

stphi avatar Apr 02 '25 12:04 stphi

\FileCodeBox-master.venv\Lib\site-packages\pydantic_internal_config.py

raw_annotations = namespace.get('annotations', {}) if raw_annotations.get('model_config') and config_dict_from_namespace is None: raise PydanticUserError( 'model_config cannot be used as a model field name. Use model_config for model configuration.', code='model-config-invalid-field-name', ) 在虚拟环境中,将pydantic_internal_config.py文件中的 if 注释掉就能正常启动项目

降低python版本试试

stphi avatar Apr 02 '25 13:04 stphi