卸载通过 sudo pip 安装的 virtualenv

卸载通过 sudo pip 安装的 virtualenv

***********更新2********************

尝试使用 virtualenv 创建虚拟环境并成功。

[08:05 USER@system ~] > mkdir test_virtual
[08:05 USER@system ~] > virtualenv test_virtual/
New python executable in /home/USER/test_virtual/bin/python
Installing setuptools, pip, wheel...done.
[08:05 USER@system ~] > ls test_virtual/
bin  include  lib  local  pip-selfcheck.json

***********更新1********************

根据要求,以下是 pastebin 链接点列表pip3 列表

***********原来的******************

我使用 sudo pip install virtualenv 安装了 virtualenv,阅读了这里的几个答案后发现这实际上不是一个好习惯。当我尝试卸载它时(主要是因为我打算采用 anaconda 方式,而且我不喜欢在系统上使用多余的 dirt),我收到以下错误:

(09:20 USER@system ~) > sudo pip uninstall virtualenv
The directory '/home/USER/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled.
Please check the permissions and owner of that directory.
If executing pip with sudo, you may want sudo's -H flag.
Cannot uninstall requirement virtualenv, not installed
The directory '/home/USER/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled.
Please check the permissions and owner of that directory.
If executing pip with sudo, you may want sudo's -H flag.

当我使用sudo -H标志时,我得到了这个:

Cannot uninstall requirement virtualenv, not installed

但我确认 virtualenv 仍然安装:

(09:25 USER@system ~) > which virtualenv
virtualenv is /usr/local/bin/virtualenv
virtualenv is /usr/local/bin/virtualenv
virtualenv is /usr/local/bin/virtualenv
virtualenv is /usr/local/bin/virtualenv

如何从我的系统中卸载 virtualenv?

谢谢。

答案1

我一直在寻找同样的东西,偶然看到了这个。你可以做到这一点。

sudo apt-get remove virtualenv  
sudo apt-get remove --auto-remove virtualenv 

如果正常的话,下面的语句就不会被执行。不过可以试一次。

sudo apt-get purge python-virtualenv  
sudo apt-get purge --auto-remove python-virtualenv

答案2

尝试一下sudo pip remove virtualenv,这应该可行

答案3

sudo apt remove python3-venv

。。。这是真正能起到作用的命令!

相关内容