Python 报错无法从distutils导入sysconfig

image

环境

  • Ubuntu 18.04
  • Python 3.8.2

错误

2020-03-25_5e7b2231a391a.png

查看pip版本的时候,执行pip -V
报错cannot import name 'sysconfig' from 'distutils'

解决

  • 添加源(原有基础上)

    1
    sudo vim /etc/apt/sources.list
  • 把下面的内容插入到sources.list中去

    1
    2
    3
    4
    deb http://cn.archive.ubuntu.com/ubuntu bionic main multiverse restricted universe
    deb http://cn.archive.ubuntu.com/ubuntu bionic-updates main multiverse restricted universe
    deb http://cn.archive.ubuntu.com/ubuntu bionic-security main multiverse restricted universe
    deb http://cn.archive.ubuntu.com/ubuntu bionic-proposed main multiverse restricted universe
  • update更新命令

    1
    sudo apt-get update
  • 安装pip3

    1
    sudo apt-get install python3-pip

成功

2020-03-25_5e7b274f316b9.png

再次查看pip版本,可以看到正常返回pip版本信息

-------------本文结束感谢您的阅读-------------
0%