ModuleNotFoundError: No module named 'setuptools' 怎么解决

最近在构建 mkdocs-material 时出现了问题,跟着文档走死活执行不了 pip install -e ".[recommended]",报了错:

ERROR: Command errored out with exit status 1:
     command: 'd:\mkdocs-material\venv\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'D:\\mkdocs-material\\setup.py'"'"'; __file__='"'"'D:\\mkdocs-material\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
         cwd: D:\mkdocs-material\
    Complete output (3 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'setuptools'

一定要把 pip 版本更新到最新,而且因为构建是在虚拟环境中的,执行 d:\mkdocs-material\venv\scripts\python.exe -m pip install --upgrade pip(根据你的虚拟环境地址来,比如我这里虚拟环境是 d:\mkdocs-material 下的,一般会提示的)才能更新完成。

posted @ 2024-09-08 05:44  ZnPdCo  阅读(90)  评论(0编辑  收藏  举报