You just execute the appropriate shell commands via Python Kind Regards,
Abdur-Rahmaan Janhangeer about <https://compileralchemy.github.io/> | blog <https://www.pythonkitchen.com> github <https://github.com/Abdur-RahmaanJ> Mauritius On Mon, Jan 4, 2021 at 7:34 PM Chris Angelico <ros...@gmail.com> wrote: > On Tue, Jan 5, 2021 at 2:29 AM Abdur-Rahmaan Janhangeer > <arj.pyt...@gmail.com> wrote: > > > > Unfortunately, that wouldn't work. Activating a virtual environment > > means setting some env vars in the current shell, and Python is > > fundamentally unable to do that - it can only be done within the shell > > itself (by sourcing a script). > > > > You can, of course, simply run the Python executable from that venv, > > but activation is *by its nature* a shell feature, and will differ by > > shell. > > > > ChrisA > > > > It's somewhat easy > > > > > > def activate_on_linux(): > > sys.subprocess([sys.executable, ...]) > > > > Not sure what this means. Can you elaborate? > > Also, "Linux" or "Windows" isn't really the thing. It needs to care > about the shell, not the operating system. > > ChrisA > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/3BZZX3BTYDUB2P5MFYRYSXCD254HGIU3/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/R6YW27IV4DBZG5GT566ISXYN2DL6C7LA/ Code of Conduct: http://python.org/psf/codeofconduct/