Ubuntu18.04下是默认没有pip的,通过sudo apt install python-pip 会报错,E:Unable to locate package xxx
网上的一些教程什么 sudo apt update 不好使
解决方案:
1、安装下载工具 sudo apt install curl
2、下载:curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
3 、安装 sudo python3 get-pip.py(可能会报错)
E: cannot import sysconfig
4 报错的解决方法
1)添加apt源
sudo gedit /etc/apt/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)
sudo apt-get install python3-distutils
再次安装:sudo python3 get-pip.py
安装成功
网友评论