Question

I want to write a small shell script to start multiple python programs as background processes. Therefore, I plan to have the following sequence multiple times:

1. activate virtual environment
2. start python program as background process
3. deactivate virtual environment
...repeat with another program

Does the deactivation of the virtual environment affect the running process?

Était-ce utile?

La solution

No. The environment as changed by virtualenv is copied for the new process and is not altered from the outside after that.

BTW, you don't need to activate a virtualenv in order to use it to start a process. It is sufficient to use the env's python interpreter (by using it's full path like /path_to_venv/bin/python)—and maybe set additional environment variables beforehand—to start your process.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top