PYTHONPATH vs Python Virtual Environment

Sina Mobasheri sinamobasheri at outlook.com
Fri Feb 4 10:55:50 EST 2022


it's not good title defiantly and I don't mean to compare apples and oranges

when I start using python virtual environment it was because isolation proposes and everyone say about its benefits in isolation and working with different versions of the same package in different projects

but recently I start using pip install --target <package> for zipapp<https://docs.python.org/3.10/library/zipapp.html#creating-standalone-applications-with-zipapp> things, and then I use this pip's option (--target) and add its target folder to PYTHONPATH and target folder's bin directory to PATH, so it's like virtual environment to me

I'm curious what is a problem with this approach (edges), what are other benefits of the virtual environment that this way can't offer? most tutorials talk about isolation and managing of packages versions but I think maybe it's more than that maybe?


More information about the Python-list mailing list