Is it possible to install a python package into a virtual environment without activating it? Imagine you just wish to update a virtual envorinment without activating it and install the package in it.
CodePudding user response:
You can use python
from a virtual environment without activating the environment. For example if a virtual environment was created at /some/path/to/venv
use /some/path/to/venv/bin/python
— the program notices it's in a virtual environment and acts as if the environment is activated. To install a package run
/some/path/to/venv/bin/python -m pip install -U package_name