No module named ‘_ctypes‘ 错误解决

No module named '_ctypes' 错误解决

0. 错误信息

  Preparing editable metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing editable metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [63 lines of output]
      ModuleNotFoundError while trying to load entry-point bdist_wheel: No module named '_ctypes'
      running dist_info
      creating /tmp/pip-modern-metadata-pmx_1nmb/fschat.egg-info
      writing /tmp/pip-modern-metadata-pmx_1nmb/fschat.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-modern-metadata-pmx_1nmb/fschat.egg-info/dependency_links.txt
      writing requirements to /tmp/pip-modern-metadata-pmx_1nmb/fschat.egg-info/requires.txt
      writing top-level names to /tmp/pip-modern-metadata-pmx_1nmb/fschat.egg-info/top_level.txt
      writing manifest file '/tmp/pip-modern-metadata-pmx_1nmb/fschat.egg-info/SOURCES.txt'
      reading manifest file '/tmp/pip-modern-metadata-pmx_1nmb/fschat.egg-info/SOURCES.txt'
      adding license file 'LICENSE'
      writing manifest file '/tmp/pip-modern-metadata-pmx_1nmb/fschat.egg-info/SOURCES.txt'
      creating '/tmp/pip-modern-metadata-pmx_1nmb/fschat-0.2.32.dist-info'
      Traceback (most recent call last):
        File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 181, in prepare_metadata_for_build_editable
          return hook(metadata_directory, config_settings)
        File "/tmp/pip-build-env-25uka66q/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 473, in prepare_metadata_for_build_editable
          return self.prepare_metadata_for_build_wheel(
        File "/tmp/pip-build-env-25uka66q/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 396, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/tmp/pip-build-env-25uka66q/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 1, in <module>
        File "/tmp/pip-build-env-25uka66q/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-25uka66q/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/tmp/pip-build-env-25uka66q/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-25uka66q/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-25uka66q/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-25uka66q/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-25uka66q/overlay/lib/python3.10/site-packages/setuptools/command/dist_info.py", line 112, in run
          bdist_wheel = self.get_finalized_command('bdist_wheel')
        File "/tmp/pip-build-env-25uka66q/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 304, in get_finalized_command
          cmd_obj = self.distribution.get_command_obj(command, create)
        File "/tmp/pip-build-env-25uka66q/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 860, in get_command_obj
          klass = self.get_command_class(command)
        File "/tmp/pip-build-env-25uka66q/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 736, in get_command_class
          self.cmdclass[command] = cmdclass = ep.load()
        File "/usr/local/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
          module = import_module(match.group('module'))
        File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
          return _bootstrap._gcd_import(name[level:], package, level)
        File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
        File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
        File "<frozen importlib._bootstrap_external>", line 883, in exec_module
        File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
        File "/tmp/pip-build-env-25uka66q/normal/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 28, in <module>
          from .macosx_libfile import calculate_macosx_platform_tag
        File "/tmp/pip-build-env-25uka66q/normal/lib/python3.10/site-packages/wheel/macosx_libfile.py", line 43, in <module>
          import ctypes
        File "/usr/local/lib/python3.10/ctypes/__init__.py", line 8, in <module>
          from _ctypes import Union, Structure, Array
      ModuleNotFoundError: No module named '_ctypes'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

解决方法

sudo apt-get install libffi-dev

重要:然后重新安装 Python

完结!

相关推荐
pk_xz12345637 分钟前
Shell 脚本中变量和字符串的入门介绍
linux·运维·服务器
懒大王爱吃狼39 分钟前
Python教程:python枚举类定义和使用
开发语言·前端·javascript·python·python基础·python编程·python书籍
小珑也要变强39 分钟前
Linux之sed命令详解
linux·运维·服务器
深度学习实战训练营44 分钟前
基于CNN-RNN的影像报告生成
人工智能·深度学习
秃头佛爷2 小时前
Python学习大纲总结及注意事项
开发语言·python·学习
昨日之日20063 小时前
Moonshine - 新型开源ASR(语音识别)模型,体积小,速度快,比OpenAI Whisper快五倍 本地一键整合包下载
人工智能·whisper·语音识别
Lary_Rock3 小时前
RK3576 LINUX RKNN SDK 测试
linux·运维·服务器
浮生如梦_3 小时前
Halcon基于laws纹理特征的SVM分类
图像处理·人工智能·算法·支持向量机·计算机视觉·分类·视觉检测
深度学习lover3 小时前
<项目代码>YOLOv8 苹果腐烂识别<目标检测>
人工智能·python·yolo·目标检测·计算机视觉·苹果腐烂识别
热爱跑步的恒川4 小时前
【论文复现】基于图卷积网络的轻量化推荐模型
网络·人工智能·开源·aigc·ai编程