[英]How should I uninstall all packages I've installed via pip? My virtual environments were working fine until I started installing API packages
Im working on a 16in MacBook Pro and only rely on basic python3 with pip.我在 16 英寸的 MacBook Pro 上工作,并且只依赖带有 pip 的基本 python3。 How to go about cleaning things up so that I only with the necessities I can build up my environments again quickly as at this point I only have a Django and flask Env set up and don't mind recreating them.
如何 go 进行清理工作,以便我只有在需要时才能再次快速建立我的环境,因为此时我只有 Django 和 Z319C3206A7F10C17C3B69116D4A957 设置它们。
My virtual environments previously had vary few things in them, my projects current don't require to much but at the end of a long day I started exploring API's and thought I had activated a new environment that created moments before just to contain any new packages.我的虚拟环境以前的东西很少,我现在的项目不需要太多,但是在漫长的一天结束后,我开始探索 API,并认为我已经激活了一个新环境,该环境在之前创建了一个新环境,只是为了包含任何新包. A few days later when attempting to update some models from Python shell i was faced with an error asking me to check my Django project settings but after much trouble shooting we discovered it was the that I didn't activate the environment when installing the packages.
几天后,当尝试从 Python shell 更新某些型号时,我遇到了一个错误,要求我检查我的 Django 项目设置,但在安装软件包时发现了很多问题,但我没有激活环境。
I so far plan on just pip uninstalling one by one, but I don't want to remove the wrong thing and have much work to complete after undoing what broke.到目前为止,我只计划 pip 一个一个地卸载,但我不想删除错误的东西,并且在撤消损坏的东西后还有很多工作要完成。
asgiref 3.2.7 astroid 2.4.1 autopep8 1.5.3 bcrypt 3.1.7 cffi 1.14.0 click 7.1.2 cssselect 1.1.0 d 0.2.2 Django 3.0.8 Flask 1.1.2 isort 4.3.21 itsdangerous 1.1.0 Jinja2 2.11.2 lazy-object-proxy 1.4.3 lxml 4.5.1 Markdown 3.2.2 MarkupSafe 1.1.1 mccabe 0.6.1 pip 20.1.1 pycodestyle 2.6.0 pycparser 2.20 Pygments 2.6.1 pylint 2.5.2 pyquery 1.4.1 pytz 2020.1 setuptools 41.2.0 six 1.15.0 sqlparse 0.3.1 toml 0.10.1 Werkzeug 1.0.1 wrapt 1.12.1 asgiref 3.2.7 astroid 2.4.1 autopep8 1.5.3 bcrypt 3.1.7 cffi 1.14.0 click 7.1.2 cssselect 1.1.0 d 0.2.2 Django 3.0.8 Flask 1.1.2 isort 4.3.21 itsdangerous 1.1.0 Jinja2 2.11 .2 lazy-object-proxy 1.4.3 lxml 4.5.1 Markdown 3.2.2 MarkupSafe 1.1.1 mccabe 0.6.1 pip 20.1.1 pycodestyle 2.6.0 pycparser 2.20 Pygments 2.6.1 pylint 2.5.2 pyquery 1.4.1 pytz 2020.1 setuptools 41.2.0 六个 1.15.0 sqlparse 0.3.1 toml 0.10.1 Werkzeug 1.0.1 wrapt 1.12.1
Follow the below steps请按照以下步骤操作
Just make a list of the packages you want to remove.只需列出要删除的软件包即可。
save it in the txt file.保存在txt文件中。
use below command使用以下命令
pip uninstall -r file_name.txt
If you want to remove all the packages except builtins.如果要删除除内置程序之外的所有软件包。 Use below steps
使用以下步骤
Run the below commands in your environment在您的环境中运行以下命令
pip freeze > dependencies.txt
Uninstall using below command使用以下命令卸载
pip uninstall -r dependencies.txt
You could use a tool like pipdeptree or deptree to help you figure out what project is a dependency of which, and thus help you decide which ones you want to remove and which ones you want to keep.您可以使用pipdeptree或deptree 之类的工具来帮助您确定哪个项目是哪个项目的依赖项,从而帮助您决定要删除哪些项目以及要保留哪些项目。
But it might be easier to start with a fresh virtual environment and install only the things you need in a clean environment.但是从一个全新的虚拟环境开始并在干净的环境中只安装你需要的东西可能会更容易。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.