我是python的新手,当我通过pip3安装软件包时,我搞砸了“ sudo pip3”和“ pip3”(那时候我不知道有什么区别)。最近,我想删除以前安装的所有软件包,我已经尝试过
pip3 freeze > rquirements.txt
pip3 uninstall -r requirements.txt -y
我明白了
Cannot uninstall 'apturl'. It is a distutils installed project and
thus we cannot accurately determine which files belong to it which
would lead to only a partial uninstall
比我尝试添加带有-H标志的sudo
sudo -H pip3 uninstall -r requirements.txt -y
这次我得到了很多未卸载的软件包
Not uninstalling apturl at /usr/lib/python3/dist-packages, outside environment /usr
Not uninstalling asn1crypto at /usr/lib/python3/dist-packages, outside environment /usr
Not uninstalling brlapi at /usr/lib/python3/dist-packages, outside environment /usr
Not uninstalling certifi at /usr/lib/python3/dist-packages, outside environment /usr
Not uninstalling chardet at /usr/lib/python3/dist-packages, outside environment /usr
Not uninstalling command-not-found at /usr/lib/python3/dist-packages, outside environment /usr
.
.
.
我不知道发生了什么,需要一些帮助
答案 0 :(得分:1)
如果您使用的是pip v10或更高版本,则distutils中的软件包不会被卸载,而通过pip安装的其余软件包可以使用来卸载
pip freeze | xargs pip uninstall -y
pip3 freeze | xargs pip3 uninstall -y