Closed Mandera closed 1 year ago
pyvenv.cfg
looks different for every venv package. Here is built-in venv
vs virtualenv
A general solution for activating a venv is not straight-forward. I should learn what happens when you activate a venv.
virtualenv
creates an activate_this.py
file in Scripts, it modified these values:
sys.real_prefix
sys.prefix
sys.path
sys.executable
which points to active interpreterMaybe I should not bother with this. There are 6 ways to run the activate
file depending on os and cmd.
Options:
Scripts/activate
- Started on that hereactivate_this.py
, could even copy that filepython=True
use the Venv's interpreter
sys.executable
, maybe with a context manager?Doesn't seem too complicated to activate venv manually.
Scripts
path to env var PATH
sys.prefix
and env var VIRTUAL_ENV
to venv foldersys.executable
to python.exe
from venvsys.path
*added in editSeems to work nicely to activate venv manually https://github.com/ManderaGeneral/generalpackager/commit/b229a6b62d5398045202a2cfbd644ffeee700456
Just noticed 'C:\Python\Venvs\dev11' is in sys.path
as well. Should do something similar as to env var PATH when activating
Found this to list installed python versions, super neat! https://stackoverflow.com/a/53330912/3936044
Extract from py --list-paths
It yielded two paths that no longer exist, I need to figure out where these paths are defined. Otherwise I should do an is_file
check before returning
From #17
What's the difference between venv and virtualenv? venv is builtin, virtualenv is one of many third party packages