ubuntu18.04(python3.6)安装pip3报错:ImportError: cannot import name 'sysconfig'

  1. 错误描述

启动pip3时报错:

Traceback (most recent call last): File "/usr/bin/pip3", line 9, in <module> from pip import main File "/usr/lib/python3/dist-packages/pip/__init__.py", line 14, in <module> from pip.utils import get_installed_distributions, get_prog File "/usr/lib/python3/dist-packages/pip/utils/__init__.py", line 23, in <module> from pip.locations import ( File "/usr/lib/python3/dist-packages/pip/locations.py", line 9, in <module> from distutils import sysconfig ImportError: cannot import name 'sysconfig'

2.解决方案:

2.1 添加源(原有基础上)

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

2.2 安装pip3

sudo apt-get install python3-pip

2.3 安装distutils,解决报错问题

sudo apt-get install python3-distutils
    原文作者:touchfl0w
    原文地址: https://blog.csdn.net/qq_27366789/article/details/80559074
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞