Skip to content

安装‘distutils’ 包的时候报错提示ModuleNotFoundError No module named ‘distutils

问题

安装‘distutils’ 包的时候报错提示 ModuleNotFoundError: No module named 'distutils

问题原因

Pycharm 是 3.12.1 版本,官网提示从 Python 3.10 开始,distutils 模块已被标记为弃用,并在 Python 3.12 中正式删除。

解决方法

  1. 安装低版本的 pycharm 然后安装‘distutils’ 包。
  2. 作为替代,推荐使用 setuptoolswheel 等现代化的构建和分发工具。如果依旧使用的是 Python 3.10 或更高版本,并且之前的代码中使用了 distutils,强烈建议将其迁移到 setuptoolssetuptools 是一个功能更强大的工具,可以更方便地构建、打包和分发 Python 项目。

原文链接:https://ceshiren.com/t/topic/31576