ubuntu18.04(python3.6)安裝pip3報錯:ImportError: cannot import name 'sysconfigpython
錯誤描述
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'
解決方案:
添加源(原有基礎上)
sudo vim /etc/apt/sources.listbootstrap
把下面的內容插入到sources.list
中去ubuntu
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 updatevim
安裝pip3
sudo apt-get install python3-pipionic
安裝 distutils
,解決報錯問題
sudo apt-get install python3-distutilsspa