0

It looks as though previously it was possible to activate a virtual environment within a script using...

activate_this_file = "/path/to/virtualenv/bin/activate_this.py"
execfile(activate_this_file, dict(__file__=activate_this_file))

Then activate_this.py was removed. For a while people were using old versions of activate_this.py. Is this still possible or has this function been removed?

Solebay Sharp
  • 519
  • 7
  • 24
  • No, because you'd then need to restart (start is the better word) the correct interpreter ("activating" is merely pointing the entrypoint to another interpreter). This feels like an [xy](https://xyproblem.info) problem. What are you really trying to achieve? – DeepSpace Feb 27 '22 at 11:18
  • Either way I've marked a duplicate that shows how to do something close - running a Python script from another using `subprocess` using a virtualenv – DeepSpace Feb 27 '22 at 11:20
  • Yes, this is the old answer to this question that is no longer valid. – Solebay Sharp Feb 27 '22 at 11:22

0 Answers0