python cannot import name 'sysconfig' from 'distutils'

本文详细记录了在Ubuntu18.04环境下,使用Python3.8.2时遇到的pip无法导入'sysconfig'模块的问题及解决过程。通过添加新的软件源并更新系统,最终成功安装pip3并验证其正常运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

image

环境

  • Ubuntu 18.04
  • Python 3.8.2

错误

2020-03-25_5e7b2231a391a.png

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

解决

  • 添加源(原有基础上)
sudo vim /etc/apt/sources.list
  • 把下面的内容插入到sources.list中去
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更新命令
sudo apt-get update
  • 安装pip3
sudo apt-get install python3-pip

成功

2020-03-25_5e7b274f316b9.png

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

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值