[英]How to remove all packages I installed via pip and without virtualenv?
I have installed some packages by accident without being in a virtual environment. 我偶然在虚拟环境中安装了一些软件包。 Thus I wish to uninstall all packages, I installed via pip.
因此,我希望卸载所有通过pip安装的软件包。
This does not work: 这不起作用:
$ pip freeze -l > dump.txt $ cat dump.txt | xargs pip uninstall -y
Because: 因为:
Uninstalling python-ldap-3.0.0:
Exception:
Traceback (most recent call last):
File "/home/leonhard/.local/lib/python2.7/site-packages/pip/_internal/basecommand.py", line 228, in main
status = self.run(options, args)
File "/home/leonhard/.local/lib/python2.7/site-packages/pip/_internal/commands/uninstall.py", line 68, in run
auto_confirm=options.yes, verbose=self.verbosity > 0,
File "/home/leonhard/.local/lib/python2.7/site-packages/pip/_internal/req/req_install.py", line 661, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/home/leonhard/.local/lib/python2.7/site-packages/pip/_internal/req/req_uninstall.py", line 219, in remove
renames(path, new_path)
File "/home/leonhard/.local/lib/python2.7/site-packages/pip/_internal/utils/misc.py", line 273, in renames
shutil.move(old, new)
File "/usr/lib/python2.7/shutil.py", line 314, in move
rmtree(src)
File "/usr/lib/python2.7/shutil.py", line 266, in rmtree
onerror(os.remove, fullname, sys.exc_info())
File "/usr/lib/python2.7/shutil.py", line 264, in rmtree
os.remove(fullname)
OSError: [Errno 13] Keine Berechtigung: '/usr/lib/python2.7/dist-packages/ldap/asyncsearch.py'
Is there an easy way to uninstall all locally install python packages? 有一种简单的方法可以卸载所有本地安装的python软件包吗?
since I cant post just comments, you can try this command: pip uninstall -y -r <(pip freeze)
. 由于我无法发表评论,因此您可以尝试以下命令:
pip uninstall -y -r <(pip freeze)
。 It clears your user packages folder outside of the context of a virtualenv. 它将在virtualenv上下文之外清除您的用户包文件夹。 Try this command with care.
请谨慎尝试此命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.