python3使用get-pip.py报错No module named ‘distutils.util’ | 【韩涛博客】

python3使用get-pip.py报错No module named ‘distutils.util’

什么是 Get-pip

官方用来安装 pip 的脚本

问题

使用官方的安装脚本 get-pip.py 时出现了以下报错信息

Traceback (most recent call last):
  File "/home/get-pip.py", line 24311, in <module>
    main()
  File "/home/get-pip.py", line 139, in main
    bootstrap(tmpdir=tmpdir)
  File "/home/get-pip.py", line 115, in bootstrap
    monkeypatch_for_cert(tmpdir)
  File "/home/get-pip.py", line 96, in monkeypatch_for_cert
    from pip._internal.commands.install import InstallCommand
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/tmp11o_c8qs/pip.zip/pip/_internal/commands/__init__.py", line 9, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/tmp11o_c8qs/pip.zip/pip/_internal/cli/base_command.py", line 12, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/tmp11o_c8qs/pip.zip/pip/_internal/cli/cmdoptions.py", line 21, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/tmp11o_c8qs/pip.zip/pip/_vendor/packaging/utils.py", line 9, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/tmp11o_c8qs/pip.zip/pip/_vendor/packaging/tags.py", line 7, in <module>
ModuleNotFoundError: No module named 'distutils.util'

处理

最后一行明确提出有模块缺失,我们再安装一下这个模块

apt-get install python3-distutils

再运行 python3 get-pip.py 就不会报错了

该文章首发在:韩涛文库

广告

发表评论 取消回复
表情 图片 链接 代码

分享
×
订阅图标按钮