Getting an embedded Python runtime to use the current active virtualenv

B

Brian Rossa

Hi all,

I've had this question up on Stackoverflow for a while but no one has
yet come along with an authoritative answer.

I've written some C code that interfaces with a Python package through
an embedded Python runtime. All of it works pretty well except that
now I want the embedded runtime to use a virtualenv. The workflow that
I'm used to with virtualenvs starts with "source activate" but,
AFAICT, all that does is set the $PATH to prefer a special executable;
it doesn't do anything special to other environment variables. I could
be missing something here, but trying to "discover" the appropriate
$PYTHONHOME and $PYTHONPATH from the $PATH and then feed them to the
embedded runtime seems like a kludge at best. I'm guess that there has
to be a *right* way to do this. Could somebody give me a clue?

Thanks!
~Brian

PS - If you want some rep:
http://stackoverflow.com/questions/...-runtime-to-use-the-current-active-virtualenv
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top