PIP does not work on virtualenv

0

After activating virtutalenv the pip does not work, I get the following error

wilker@debian:~/Documentos/Git/Curso Django/Blog$ source bin/activate
(Blog) wilker@debian:~/Documentos/Git/Curso Django/Blog$ pip freeze
bash: /home/wilker/Documentos/Git/Curso Django/Blog/bin/pip: "/home/wilker/Documentos/Git/Curso: bad interpreter: Arquivo ou diretório não encontrado

But outside of it it works normally. I already removed the pip, and virtualenv and reinstalled them.

I tried again and received the same error.

wilker@debian:~/Documentos/Git/Curso Django$ virtualenv Blog
New python executable in /home/wilker/Documentos/Git/Curso Django/Blog/bin/python
Installing setuptools, pip, wheel...done.
wilker@debian:~/Documentos/Git/Curso Django$ cd Blog/
wilker@debian:~/Documentos/Git/Curso Django/Blog$ source bin/activate
(Blog) wilker@debian:~/Documentos/Git/Curso Django/Blog$ pip
bash: /home/wilker/Documentos/Git/Curso Django/Blog/bin/pip: "/home/wilker/Documentos/Git/Curso: bad interpreter: Arquivo ou diretório não encontrado
    
asked by anonymous 09.12.2016 / 03:03

2 answers

0

The problem was the space in the directory name in "Course Django".

  

wilker@debian:~/Documentos/Git/Curso Django$ virtualenv Blog

Apparently the absolute path of a virtual environment should not contain spaces, since the scripts generated for virtualenv do not deal well with spaces. As said in:

  

Create your virtualenv environment within a path without spaces. This   is why happening:

     

When you create an environment, it sets up a bin directory. In that bin directory are all executables relating to the environment. Some are scripts. As you may know, hashbangs are used to tell thesystem what to interpreter to use to run the script. You may see this at the top of scripts often:

     

#!/usr/bin/env python

     If the script is at /tmp/test.py , that tells the system to run this command to execute the script:

     

/usr/bin/env python /tmp/test.py

     

In your case, virtualenv is creating   scripts like this:

     

#!/tmp/oh no/bin/python

     

When the system tries to execute that, it will try to execute the command /tmp/oh with the arguments no/bin/python and /tmp/test.py . /tmp/oh does not exist, so it fails.

Retrieved from: link

    
10.12.2016 / 02:45
0

Try to use the command python -m pip install nome_do_pacote

    
31.01.2018 / 17:10