error installing virtualenv in python
I can not create the virtualenv, I gave a survey teaching how to install and qdo I scratch the install her from this error here
Python Version 3.8.3
> root@AlexPc:/# apt install python3-virtualenv Lendo listas de
> pacotes... Pronto Construindo árvore de dependências Lendo
> informação de estado... Pronto Alguns pacotes não puderam ser
> instalados. Isto pode significar que você solicitou uma situação
> impossível ou, se você está usando a distribuição instável, que alguns
> pacotes requeridos não foram criados ainda ou foram retirados da
> "Incoming". A informação a seguir pode ajudar a resolver a situação:
>
> Os pacotes a seguir têm dependências desencontradas:
> python3-virtualenv : Depende: python3-distutils mas não é instalável
> Depende: python3-importlib-metadata mas não é instalável
> Depende: python3-appdirs mas não é instalável E: Impossível corrigir problemas, você manteve (hold) pacotes quebrados.*
What if I try to install by the older python I installed tb to test this error
Python version 2.7. 18rc1
> root@AlexPc:/# apt install python-virtualenv Lendo listas de
> pacotes... Pronto Construindo árvore de dependências Lendo
> informação de estado... Pronto O pacote python-virtualenv não está
> disponível, mas é referenciado por outro pacote. Isto pode significar
> que o pacote está faltando, ficou obsoleto ou está disponível somente
> a partir de outra fonte
>
> E: O pacote 'python-virtualenv' não tem candidato para instalação
> root@AlexPc:/#
If I try to install with pip appears this msg
> root@AlexPc:/home/alex# pip install virtualenv
>
> O comando 'pip' não foi encontrado, mas existem 18 semelhantes.
>
> root@AlexPc:/home/alex#
What if I try to install pip both in QQ version of python appears that
> root@AlexPc:/home/alex# sudo apt install python-pip Lendo listas de
> pacotes... Pronto Construindo árvore de dependências Lendo
> informação de estado... Pronto E: Impossível encontrar o pacote
> python-pip root@AlexPc:/home/alex# sudo apt install python3-pip Lendo
> listas de pacotes... Pronto Construindo árvore de dependências
> Lendo informação de estado... Pronto Alguns pacotes não puderam ser
> instalados. Isto pode significar que você solicitou uma situação
> impossível ou, se você está usando a distribuição instável, que alguns
> pacotes requeridos não foram criados ainda ou foram retirados da
> "Incoming". A informação a seguir pode ajudar a resolver a situação:
>
> Os pacotes a seguir têm dependências desencontradas: python3-pip :
> Depende: python3-distutils mas não é instalável
> Depende: python3-setuptools mas não é instalável
> Recomenda: python3-dev (>= 3.2) mas não é instalável E: Impossível corrigir problemas, você manteve (hold) pacotes quebrados.
> root@AlexPc:/home/alex#
My OS is Linux-ubuntu
3 answers
Let's start by installing pip. In your terminal enter:
wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
With Pip installed, we will install virtualenv and virtualwrapper:
sudo pip3 install virtualenv virtualenvwrapper
Now let's configure the environment. You need to find the ~/file.bashrc. Go to your / home by the same file browser and press ctrl + H to see the hidden files. You will see the file .bashrc. At the end of it enter:
# local onde os ambientes serão armazenados
export WORKON_HOME=~/.virtualenvs
# Local do python para o qual o virtualenv foi instalado (no caso Python3)
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
# Adicionar os comandos virtualenvwrapper no bash
source /usr/local/bin/virtualenvwrapper.sh
# define que não é possível utilizar o pip fora de algum ambiente virtual
export PIP_REQUIRE_VIRTUALENV=true
Now let's create a virtualenv to test if everything went right. Open a new one terminal and enter:
mkvirtualenv -p /usr/bin/python3.8 ambiente_teste
The-p flag indicates a specific version of python for your virtual environment. If you do not pass a version, the default version of the system will be used. You could have just passed mkvirtualenv ambiente_teste
, for example.
If you use linux, you must install virtualenv
by apt-get
Follow commando for installation:
$ sudo apt-get install virtualenv
After installing virtualenv you can use pip.
To start the environment with python3, just run the command:
$ virtualenv env -p $(which python3)
It worked out what Vitor Guimarães answered, only I had to install By python2.7. 18rc1. I think the python3 of my PC ta zuado msm, follows below what I did
> wget https://bootstrap.pypa.io/get-pip.py
Followed by the command
> sudo python get-pip.py
Then in home I opened the file ->.bashrc - > and pasted at the end of it
# local onde os ambientes serão armazenados
export WORKON_HOME=~/.virtualenvs
# Local do python para o qual o virtualenv foi instalado (no caso Python)
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python
# Adicionar os comandos virtualenvwrapper no bash
source /usr/local/bin/virtualenvwrapper.sh
# define que não é possível utilizar o pip fora de algum ambiente virtual
export PIP_REQUIRE_VIRTUALENV=true
And last to create I used the command
virtualenv nomeDoVirtualenv
Followed by the command and to test I activated virtualenv with the command
source nomeDoVirtualenv/bin/activate
Then exits it with the command
deactivate
Thank you very much to everyone who helped me you are tops Strong hug-vlw