AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / unix / Perguntas / 773992
Accepted
mulllhausen
mulllhausen
Asked: 2024-04-07 10:21:14 +0800 CST2024-04-07 10:21:14 +0800 CST 2024-04-07 10:21:14 +0800 CST

Não é possível desinstalar o virtualenv do debian 11

  • 772

Meu sistema operacional debian passou por algumas atualizações e agora está no 11 (Bullseye). Inicialmente comecei com python2e agora não quero mais - só quero python3. Eu instalei virtualenvhá muito tempo quando ainda estava trabalhando com python2.

Eu fiz um completo dist-upgrade:

$ sudo apt-get update
Hit:1 http://deb.debian.org/debian bullseye InRelease
Get:2 https://deb.nodesource.com/node_14.x bullseye InRelease [4,586 B]
Get:3 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Hit:4 http://deb.debian.org/debian bullseye-updates InRelease
Fetched 53.0 kB in 1s (49.9 kB/s)
Reading package lists... Done
$ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  libts-dev
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

E quando verifico se virtualenvestá instalado diz que sim:

$ which virtualenv
/usr/local/bin/virtualenv

Tento desinstalá-lo, mas pipme diz que não está instalado:

$ pip uninstall virtualenv
WARNING: Skipping virtualenv as it is not installed
$ sudo pip uninstall virtualenv
WARNING: Skipping virtualenv as it is not installed.
$ pip3 uninstall virtualenv
WARNING: Skipping virtualenv as it is not installed
$ sudo pip3 uninstall virtualenv
WARNING: Skipping virtualenv as it is not installed.

Também tentei desinstalar com o gerenciador de pacotes caso tenha sido instalado dessa forma

$ sudo apt-get remove virtualenv --purge
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package 'virtualenv' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

Mas depois de tudo isso ainda posso ver que está instalado:

$ which virtualenv
/usr/local/bin/virtualenv

O motivo pelo qual desejo removê-lo é que ele apresenta um erro quando tento executá-lo. E estou pensando que removê-lo totalmente e instalar novamente resolverá isso:

$ virtualenv .
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 7, in <module>
    from virtualenv import main
ModuleNotFoundError: No module named 'virtualenv'

Devo apenas excluir /usr/local/bin/virtualenv? Isso parece uma má ideia. Como posso remover virtualenvusando um gerenciador de pacotes?

Atualização 1 - tente instalar virtualenvusandopip3

A instalação foi bem-sucedida, mas virtualenvainda não funciona sem erros:

$ pip3 install virtualenv
Defaulting to user installation because normal site-packages is not writeable
Collecting virtualenv
  Using cached virtualenv-20.25.1-py3-none-any.whl.metadata (4.4 kB)
Requirement already satisfied: distlib<1,>=0.3.7 in ./.local/lib/python3.9/site-packages (from virtualenv) (0.3.8)
Requirement already satisfied: filelock<4,>=3.12.2 in ./.local/lib/python3.9/site-packages (from virtualenv) (3.13.3)
Requirement already satisfied: platformdirs<5,>=3.9.1 in ./.local/lib/python3.9/site-packages (from virtualenv) (4.2.0)
Using cached virtualenv-20.25.1-py3-none-any.whl (3.8 MB)
Installing collected packages: virtualenv
  WARNING: The script virtualenv is installed in '/home/me/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed virtualenv-20.25.1
$ which virtualenv
/usr/local/bin/virtualenv
$ virtualenv --version
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 7, in <module>
    from virtualenv import main
ImportError: cannot import name 'main' from 'virtualenv' (/home/me/.local/lib/python3.9/site-packages/virtualenv/__init__.py)
$ virtualenv .
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 7, in <module>
    from virtualenv import main
ImportError: cannot import name 'main' from 'virtualenv' (/home/me/.local/lib/python3.9/site-packages/virtualenv/__init__.py)

E agora virtualenvexiste em 2 locais no sistema de arquivos:

$ which virtualenv
/usr/local/bin/virtualenv
$ sudo find /usr/ -iname "virtualenv" | grep bin
/usr/local/bin/virtualenv
$ sudo find /home/me/.local/ -iname "virtualenv" | grep bin
/home/me/.local/bin/virtualenv
$ ls -l /home/me/.local/bin/virtualenv 
-rwxr-xr-x 1 me me 238 Apr  7 13:06 /home/me/.local/bin/virtualenv
debian
  • 1 1 respostas
  • 88 Views

1 respostas

  • Voted
  1. Best Answer
    Stephen Kitt
    2024-04-07T15:30:44+08:002024-04-07T15:30:44+08:00

    O gerenciador de pacotes do sistema não gerencia arquivos /usr/local.

    Dado que pipnão é possível desinstalar virtualenvpara você, sua melhor opção agora é

    sudo rm /usr/local/bin/virtualenv
    

    Pode haver outros restos em outros lugares /usr/local, mas eles não causarão nenhum dano. Você pode procurá-los mais tarde.

    Observe que no Debian 11 virtualenvestá disponível no python3-virtualenvpacote.

    • 3

relate perguntas

  • Configuração do GRUB para reconhecer diferentes ambientes de desktop (instalações) da mesma distribuição Linux

  • astyle não altera a formatação do arquivo de origem

  • Recebendo e-mail em um novo Debian fresco

  • Debian Stretch: gnome-software segfault em libgs_plugin_systemd-updates.so

  • Como digitar ü no Pinyin IME?

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Possível firmware ausente /lib/firmware/i915/* para o módulo i915

    • 3 respostas
  • Marko Smith

    Falha ao buscar o repositório de backports jessie

    • 4 respostas
  • Marko Smith

    Como exportar uma chave privada GPG e uma chave pública para um arquivo

    • 4 respostas
  • Marko Smith

    Como podemos executar um comando armazenado em uma variável?

    • 5 respostas
  • Marko Smith

    Como configurar o systemd-resolved e o systemd-networkd para usar o servidor DNS local para resolver domínios locais e o servidor DNS remoto para domínios remotos?

    • 3 respostas
  • Marko Smith

    apt-get update error no Kali Linux após a atualização do dist [duplicado]

    • 2 respostas
  • Marko Smith

    Como ver as últimas linhas x do log de serviço systemctl

    • 5 respostas
  • Marko Smith

    Nano - pule para o final do arquivo

    • 8 respostas
  • Marko Smith

    erro grub: você precisa carregar o kernel primeiro

    • 4 respostas
  • Marko Smith

    Como baixar o pacote não instalá-lo com o comando apt-get?

    • 7 respostas
  • Martin Hope
    user12345 Falha ao buscar o repositório de backports jessie 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl Por que a maioria dos exemplos do systemd contém WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky Como exportar uma chave privada GPG e uma chave pública para um arquivo 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll status systemctl mostra: "Estado: degradado" 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim Como podemos executar um comando armazenado em uma variável? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S Por que /dev/null é um arquivo? Por que sua função não é implementada como um programa simples? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 Como ver as últimas linhas x do log de serviço systemctl 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - pule para o final do arquivo 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla Por que verdadeiro e falso são tão grandes? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis Substitua a string em um arquivo de texto enorme (70 GB), uma linha 2017-12-30 06:58:33 +0800 CST

Hot tag

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve