Ubuntu18.04安装pip

Ubuntu18.04默认是没有pip的,通过sudo apt install python-pip,安装了pip之后总是报No module named 'pip'错误。

解决方案:

1.卸载pip:sudo apt-get remove python-pip

2.安装下载工具:sudo apt install curl,下载:curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py。安装pip:sudo python3 get-pip.py;

可能会报错:

解决办法: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

安装distutils,解决报错问题:sudo apt-get install python3-distutils

再次安装:sudo python3 get-pip.py

安装成功。

猜你喜欢

转载自blog.csdn.net/hzlnice/article/details/81587151