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

2018/06/08 · 干货 · 10002次阅读

1、错误描述

启动pip3时报错:

Traceback (most recent call last):
  File "get-pip.py", line 20649, in <module>
    main()
  File "get-pip.py", line 197, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 82, in bootstrap
    import pip._internal
  File "/tmp/tmp73pg421j/pip.zip/pip/_internal/__init__.py", line 42, in <module>
  File "/tmp/tmp73pg421j/pip.zip/pip/_internal/cmdoptions.py", line 16, in <module>
  File "/tmp/tmp73pg421j/pip.zip/pip/_internal/index.py", line 25, in <module>
  File "/tmp/tmp73pg421j/pip.zip/pip/_internal/download.py", line 35, in <module>
  File "/tmp/tmp73pg421j/pip.zip/pip/_internal/locations.py", line 10, in <module>
ImportError: cannot import name 'sysconfig'

2、解决方案:

2.1 添加源(原有基础上)

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

2.2 update更新命令

sudo apt-get update

2.3 安装pip3

sudo apt-get install python3-pip

2.4 安装distutils,解决报错问题

sudo apt-get install python3-distutils

喝杯水

标签:sysconfigpippython

最后编辑于:2019/04/24 23:06

添加新评论

  1. 2018-10-19 17:00
    期待楼主的分享
    回复
  2. 中文
    2018-09-22 01:38
    sudo vim /etc/apt/source.list
    sources.list
    中文
    回复