Even if successful, it happens in a subprocess that your exec.Cmd creates. It will not affect your own shell session. If you are trying to run a Python script with exec.Cmd, you can just do that directly:
cmd := exec.Cmd("/path/to/virtualenv/bin/python", "/path/to/your/code.py") Alternatively, you can just put ["PATH=/path/to/your/virtualenv/bin"] in your exec.Cmd's "Env" slice, which is pretty much all virtualenv's "activate" script does, then exec.Command("/path/to/your/script.py") (assuming your script is executable). If you want to have a Go program make changes to your interactive shell session, you'd have to connect your exec.Cmd's Stdout, Stderr, and Stdin to os.Stdout, os.Stderr, and os.Stdin an run your Go command as a "middleman" between your session and your exec.Cmd session. Finally, if you *really really* want to run a Go program and make changes to your environment after your Go program exits, you're going to have to do some clever things with your bash profile. I don't know how it works, but this project accomplishes it: https://github.com/direnv/direnv Fun fact: If you store Python code *in* your Go program (as a raw string), you can create a command with exec.Command("/path/to/your/virtualenv/bin/python") and feed the string into your cmd.Stdin. Same for bash, Perl, and whatever happens to be installed on your machine. ^_^ -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.