首页 > 其他分享 >pydantic.errors.PydanticImportError,'pydantic:compiled' 在 Pydantic 版本 2 中已被移除。

pydantic.errors.PydanticImportError,'pydantic:compiled' 在 Pydantic 版本 2 中已被移除。

时间:2023-12-04 20:44:08浏览次数:31  
标签:errors PyInstaller py module File 移除 import line pydantic

今天编译python程序时

pyinstaller -F  --version-file file_version_info.txt  MelliferaCMD.py

收到错误:

58759 INFO: Loading module hook 'hook-pydantic.py' from 'D:\\env\\fbt\\Lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
Traceback (most recent call last):
  File "D:\env\fbt\Lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 283, in get_module_attribute
    return _get_module_attribute(module_name, attr_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\isolated\_parent.py", line 403, in wrapped
    return call(function, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\isolated\_parent.py", line 372, in call
    return isolated.call(function, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\isolated\_parent.py", line 302, in call
    raise RuntimeError(f"Child process call to {function.__name__}() failed with:\n" + output)
RuntimeError: Child process call to _get_module_attribute() failed with:
  File "D:\env\fbt\Lib\site-packages\PyInstaller\isolated\_child.py", line 63, in run_next_command
    output = function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 279, in _get_module_attribute
    return getattr(module, attr_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\pydantic\__init__.py", line 363, in __getattr__
    return _getattr_migration(attr_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\pydantic\_migration.py", line 302, in wrapper
    raise PydanticImportError(f'`{import_path}` has been removed in V2.')
pydantic.errors.PydanticImportError: `pydantic:compiled` has been removed in V2.

For further information visit https://errors.pydantic.dev/2.5/u/import-error

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "D:\env\fbt\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "D:\env\fbt\Lib\site-packages\PyInstaller\__main__.py", line 194, in _console_script_run
    run()
  File "D:\env\fbt\Lib\site-packages\PyInstaller\__main__.py", line 180, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "D:\env\fbt\Lib\site-packages\PyInstaller\__main__.py", line 61, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "D:\env\fbt\Lib\site-packages\PyInstaller\building\build_main.py", line 1019, in main
    build(specfile, distpath, workpath, clean_build)
  File "D:\env\fbt\Lib\site-packages\PyInstaller\building\build_main.py", line 944, in build
    exec(code, spec_namespace)
  File "d:\mycode\tanghai\mellifera\MelliferaCMD.spec", line 7, in <module>
    a = Analysis(
        ^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\building\build_main.py", line 429, in __init__
    self.__postinit__()
  File "D:\env\fbt\Lib\site-packages\PyInstaller\building\datastruct.py", line 184, in __postinit__
    self.assemble()
  File "D:\env\fbt\Lib\site-packages\PyInstaller\building\build_main.py", line 590, in assemble
    priority_scripts.append(self.graph.add_script(script))
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 268, in add_script
    self._top_script_node = super().add_script(pathname)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1359, in add_script
    self._process_imports(n)
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2811, in _process_imports
    target_modules = self._safe_import_hook(*import_info, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 432, in _safe_import_hook
    return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2262, in _safe_import_hook
    target_modules = self.import_hook(
                     ^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1431, in import_hook
    target_package, target_module_partname = self._find_head_package(
                                             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1610, in _find_head_package
    target_package = self._safe_import_module(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 479, in _safe_import_module
    return super()._safe_import_module(module_basename, module_name, parent_package)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1992, in _safe_import_module
    self._process_imports(n)
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2811, in _process_imports
    target_modules = self._safe_import_hook(*import_info, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 432, in _safe_import_hook
    return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2262, in _safe_import_hook
    target_modules = self.import_hook(
                     ^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1431, in import_hook
    target_package, target_module_partname = self._find_head_package(
                                             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1610, in _find_head_package
    target_package = self._safe_import_module(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 479, in _safe_import_module
    return super()._safe_import_module(module_basename, module_name, parent_package)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1992, in _safe_import_module
    self._process_imports(n)
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2811, in _process_imports
    target_modules = self._safe_import_hook(*import_info, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 432, in _safe_import_hook
    return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2262, in _safe_import_hook
    target_modules = self.import_hook(
                     ^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1431, in import_hook
    target_package, target_module_partname = self._find_head_package(
                                             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1610, in _find_head_package
    target_package = self._safe_import_module(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 479, in _safe_import_module
    return super()._safe_import_module(module_basename, module_name, parent_package)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1992, in _safe_import_module
    self._process_imports(n)
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2811, in _process_imports
    target_modules = self._safe_import_hook(*import_info, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 432, in _safe_import_hook
    return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2262, in _safe_import_hook
    target_modules = self.import_hook(
                     ^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1431, in import_hook
    target_package, target_module_partname = self._find_head_package(
                                             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1610, in _find_head_package
    target_package = self._safe_import_module(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 479, in _safe_import_module
    return super()._safe_import_module(module_basename, module_name, parent_package)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1992, in _safe_import_module
    self._process_imports(n)
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2811, in _process_imports
    target_modules = self._safe_import_hook(*import_info, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 432, in _safe_import_hook
    return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2471, in _safe_import_hook
    self.import_hook(
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1470, in import_hook
    for target_submodule in self._import_importable_package_submodules(
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1720, in _import_importable_package_submodules
    submodule = self._safe_import_module(
                ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 479, in _safe_import_module
    return super()._safe_import_module(module_basename, module_name, parent_package)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1992, in _safe_import_module
    self._process_imports(n)
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2811, in _process_imports
    target_modules = self._safe_import_hook(*import_info, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 432, in _safe_import_hook
    return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2262, in _safe_import_hook
    target_modules = self.import_hook(
                     ^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1431, in import_hook
    target_package, target_module_partname = self._find_head_package(
                                             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1610, in _find_head_package
    target_package = self._safe_import_module(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 479, in _safe_import_module
    return super()._safe_import_module(module_basename, module_name, parent_package)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1992, in _safe_import_module
    self._process_imports(n)
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2811, in _process_imports
    target_modules = self._safe_import_hook(*import_info, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 432, in _safe_import_hook
    return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2262, in _safe_import_hook
    target_modules = self.import_hook(
                     ^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1431, in import_hook
    target_package, target_module_partname = self._find_head_package(
                                             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1610, in _find_head_package
    target_package = self._safe_import_module(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 479, in _safe_import_module
    return super()._safe_import_module(module_basename, module_name, parent_package)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1992, in _safe_import_module
    self._process_imports(n)
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2811, in _process_imports
    target_modules = self._safe_import_hook(*import_info, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 432, in _safe_import_hook
    return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2262, in _safe_import_hook
    target_modules = self.import_hook(
                     ^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1431, in import_hook
    target_package, target_module_partname = self._find_head_package(
                                             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1610, in _find_head_package
    target_package = self._safe_import_module(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 479, in _safe_import_module
    return super()._safe_import_module(module_basename, module_name, parent_package)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1992, in _safe_import_module
    self._process_imports(n)
  File "D:\env\fbt\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2811, in _process_imports
    target_modules = self._safe_import_hook(*import_info, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 368, in _safe_import_hook
    excluded_imports = self._find_all_excluded_imports(source_module.identifier)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\analysis.py", line 356, in _find_all_excluded_imports
    excluded_imports.update(module_hook.excludedimports)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\imphook.py", line 316, in __getattr__
    self._load_hook_module()
  File "D:\env\fbt\Lib\site-packages\PyInstaller\depend\imphook.py", line 383, in _load_hook_module
    self._hook_module = importlib_load_source(self.hook_module_name, self.hook_filename)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\compat.py", line 613, in importlib_load_source
    return mod_loader.load_module()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap_external>", line 605, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1120, in load_module
  File "<frozen importlib._bootstrap_external>", line 945, in load_module
  File "<frozen importlib._bootstrap>", line 290, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 721, in _load
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "D:\env\fbt\Lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks\hook-pydantic.py", line 22, in <module>
    is_compiled = get_module_attribute('pydantic', 'compiled') in {'True', True}
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\env\fbt\Lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 285, in get_module_attribute
    raise AttributeError(f"Failed to retrieve attribute {attr_name} from module {module_name}") from e
AttributeError: Failed to retrieve attribute compiled from module pydantic


问题出在 PyInstaller 和 Pydantic V2 的兼容性上。这个问题是由于 PyInstaller 钩子(hooks)未能及时更新以适应 Pydantic V2 的变化。解决方法是更新 PyInstaller 的钩子贡献库(pyinstaller-hooks-contrib)到最新版本。

您可以通过以下命令来更新:

pip install -U pyinstaller-hooks-contrib

这个命令会升级 pyinstaller-hooks-contrib 包到最新版本,以确保其包含所有最新的钩子,这对于 PyInstaller 正确处理依赖关系和打包过程是非常重要的。

完成这个更新后,再次尝试使用 PyInstaller 打包您的程序。这应该会解决与 Pydantic V2 相关的问题,使您能够成功创建打包的可执行文件。

参看:https://stackoverflow.com/questions/77039302/pyinstaller-with-pydantic-v2-pydanticcompiled-has-been-removed-in-v2

标签:errors,PyInstaller,py,module,File,移除,import,line,pydantic
From: https://www.cnblogs.com/ghj1976/p/pydanticerrorspydanticimporterrorpydanticcompiled.html

相关文章

  • git移除现有远程仓库文件和提交记录
    背景公司gitlab新建仓库权限被关了自己有项目想要找个服务器仓库托管,刚好服务器上有个自己之前存在的没用的仓库,所以想要清掉它把现在自己本地的git仓库push上去操作step1.清掉现有仓库找个空文件夹,将你想要托管的仓库.gitignore文件加入初始化一个新仓库,并push到服务器上没......
  • 代码随想录算法训练营第三天 | 203.移除链表元素 707.设计链表 206.反转链表
    LeetCode 203.移除链表元素视频链接:LeetCode203思路:根据链表的性质,将目标值对应的节点保存在一个临时节点中,再重新设置cur下一个节点,再将临时节点进行删除classSolution{public:ListNode*removeElements(ListNode*head,intval){//删除头节点......
  • day1数组理论基础,704. 二分查找,27. 移除元素
    数组理论基础,704.二分查找,27.移除元素1数组理论基础1.1数组概念定义:存放在连续内存空间上的相同类型数据的集合。特点:1.数组中数据类型相同2.数组所占空间连续1.2数组创建2704.二分查找给定一个n个元素有序的(升序)整型数组nums和一个目标值target,写一个函数......
  • 代码随想录算法训练营第一天| 704. 二分查找、27. 移除元素
    LeetCode704二分查找题目链接:LeetCode704左闭右闭:视频讲解:手把手带你撕出正确的二分法思路:在循环条件中注明left<=right,即[left,right]classSolution{public:intsearch(vector<int>&nums,inttarget){intleft=0,right=nums.size()-1......
  • LeetCode-Java:27.移除元素
    题目给你一个数组nums和一个值val,你需要原地移除所有数值等于val的元素,并返回移除后数组的新长度。不要使用额外的数组空间,你必须仅使用O(1)额外空间并原地修改输入数组。元素的顺序可以改变。你不需要考虑数组中超出新长度后面的元素。说明:为什么返回数值是整数......
  • 原地移除元素--c++版
    代码classSolution{public:intremoveElement(vector<int>&nums,intval){//暴力法//intnumSize=nums.size();//intptr=0;//intcount=numSize;//inttail=numSize-1;//如果最后是val,val就变多了,设置一......
  • 遍历List移除元素时踩坑点
    1、问题描述在遍历List并在循环体中移除元素时需要注意以下几点移除元素后数据总量会越来越小,可能造成数组下标越界移除元素后,每个元素原有位置也会发生改变,需确认移除的元素是否是真正需要移除的由于删除元素后,每个元素位置前移,会有部分数据直接跳过循环例如数组中有......
  • 数组类算法题——数组中移除指定元素
    数组中移除指定元素 题目:给你一个数组nums和一个值val,你需要原地移除所有数值等于val的元素,并返回移除后数组的新长度。不要使用额外的数组空间,你必须仅使用O(1)额外空间并原地修改输入数组。元素的顺序可以改变。你不需要考虑数组中超出新长度后面的元素。解......
  • Fastapi框架:Starlette,Pydantic 与 FastAPI 框架是什么关系?
    【一】介绍Starlette是个什么项目;IDE开发时Python3.5+版本的"typehints"的好处:简短、直观和标准的Python类型声明;介绍Pydantic包,FastAPI项目的开发为什么要使用Pydantic【二】Starlette【1】介绍Starlette是一种轻量级的ASGI框架/工具包,是构建高性能A......
  • Thread was being aborted Errors
    "executionTimeout"inthemachine.cofig<system.web><httpRuntimeexecutionTimeout="3600"/></system.web>TheproblemissolvedafteryoudeletetheencryptedcontentforSQlServer2008.Itworkedfor......