문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top