ImportError: No module named distro

解决方法

需要安装 distro 模块。通常用 pip 安装:

pip install distro

如果 pip 是 Python 2.7 下的 pip,且之前有 SSL 证书问题,可以使用:

pip install distro --trusted-host pypi.org --trusted-host files.pythonhosted.org

或者指定清华镜像的 HTTP 源:

pip install distro -i http://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn

另外

  • 如果用的是 Python 2.7,请注意 distro 包是支持 Python 2.7 的,但现在支持较差,建议升级 Python 版本。
  • 如果你有多个 Python 版本,确保使用对应的 pip,比如: bash复制编辑python -m pip install distro

发表回复