Skip to content

Instantly share code, notes, and snippets.

@datagrok
Last active April 8, 2023 17:36
Show Gist options
  • Save datagrok/2199506 to your computer and use it in GitHub Desktop.
Save datagrok/2199506 to your computer and use it in GitHub Desktop.
Virtualenv's `bin/activate` is Doing It Wrong
@ptvirgo
Copy link

ptvirgo commented Apr 5, 2016

I'm relatively new to Python though I've been around long enough to appreciate Unix-friendly approaches. My first tries at getting activate to work failed, so I turned to The Internet for instructions. Your article came up, and pointed me at vex. Vex worked great, and it feels much more in line with the tools I've come to expect from the CLI. This will probably go double when I start mucking about with FreeBSD, I know BASH is not the standard shell over there.

Thanks for your article and the included recommendations.

@gqmelo
Copy link

gqmelo commented May 20, 2016

I've been using conda for a while and the same problem was bothering me.
Conda has an virtualenv's style activate and it was very annoying to use the envs on a non-console application (IDE).

So I created exec-wrappers to be able to create wrappers ready to use with minimum overhead.
It also happens to create wrappers for virtualenv. So if someone is interested, please take a look.

@jerzygangi
Copy link

All I can say is +1

@pabloa
Copy link

pabloa commented Feb 3, 2017

great article. It is exactly what people need when python is integrated to other technologies (like java). python code probably is called with not terminal in the middle. This article solved my problem.

@johndpope
Copy link

@Acrisel
Copy link

Acrisel commented Jul 14, 2017

This is great. I would just note that there is no need to hard code the path of the virtualenv in shell and batch scripts. It can and should be relative.

@mmerickel
Copy link

mmerickel commented Sep 8, 2017

Please also look at vrun [1] which is super lightweight and simply activates a virtualenv for the duration of a command. You run something like env/bin/vrun <cmd> and it is executed with all of the virtualenv scripts etc on the path. This is similar to vex but with fewer assumptions and should be mentioned in the same conversation.

[1] https://pypi.org/project/vrun/

@apoliakov
Copy link

Helpful! Thank you!!

@nmaupu
Copy link

nmaupu commented Jun 21, 2022

404 on the link 👎

@benedikt-bartscher
Copy link

still 404

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment