之前虚拟机重新装了Ubuntu,所以好多东西都没了。
今天要pip greenlet模块时出现了一些问题
首先发现没有pip
然后就
sudo apt-get install python3-pip
安装pip3后正准备安装greenlet模块发现出错了
出现了一个ImportError:cannot import name‘ sysconfig ’ 的错误
上网查询后发现是 distutils 模块出现了问题,没有安装
于是按照网上的方法,需要执行
sudo apt-get install python3-distutils
然后在执行命令后又出错了
出现了 Package ’Python3-distutils ‘ has no installation candidate
没有候选安装包???我晕了
这时候继续网上冲浪。给出的方法都是apt-get update …
试了几次还是不行
最后通过修改了sources.list解决了问题
同时也在此保存一下,sources.list 首选aliyun
deb http://mirrors.aliyun.com/ubuntu bionic main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu bionic-updates main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu bionic-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu bionic-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu bionic-backports main multiverse restricted universe
修改在sudo apt-get update 发现更新速度快多了,国内的源就好。不过之前也是ali的,不知道为什么可能是安装sublime的时候搞得源混了,安装的很慢。
然后再执行sudo apt-get upgrade
最后sudo apt-get python3-distutils就行了
然后就可以使用pip3 愉快的安装想要的模块了