4 ms·
Not sure about ruby, but most of the languages I know about, C#, javascript, php, etc don't need virtualenv because they install packages in a project locally (
by rk06 6y ago
Not sure about ruby, but most of the languages I know about, C#, javascript, php, etc don't need virtualenv because they install packages in a project locally (and globally if required). so envs of one project do not clash with another.
while python install packages globally and only globally. so a virtualenv is needed to isolate different projects from one another
- imtringued 6y agoLast time I used python I just did pip install -r requirements.txt -t libs and added the folder to PYTHONPATH. I never bothered with virtualenv.
- akvadrako 6y agoThat is basically virtualenv though it won't work in as many cases. Not that there is anything wrong with it, but I don't see how it's any better.
- rk06 6y agoPYTHONPATH is also global! so all projects will still be referring to the same set of libs. how does that change anything at all?
- mixmastamyk 6y agoThat's an optional environment variable, it is not set unless you set it. Meaning you could change it to anything, per process. Also you can change sys.path. Not an issue.
- erfgh 6y agoWhat do you mean "python install[s] globally and only globally"? That's not true. You can instruct pip to install to any place you want.
- rk06 6y agothe thing is python cli has no concept of locally scoped libraries. you can install libs wherever you want, but all python.exe will refer to the same global location. this is why you need to activate virtualenv every time you open a new command line, so that it can set ENV variables for the current session and force python to use the locally scoped folders. While in C# et all. the compiler knows to check files locally. and you don't need to activate (or deactivate) environment at all.
- erfgh 6y agoYou don't need a virtualenv. You can simply launch python with the PYTHONPATH environment variable (there are also other ways).