[Tutor] Using venv

Jim jf_byrnes at comcast.net
Sat Jan 28 13:13:39 EST 2017

On 01/27/2017 04:49 PM, Cameron Simpson wrote:
> On 27Jan2017 15:47, jim <jf_byrnes at comcast.net> wrote:
>> It has been suggested to me that I should use a virtual environment
>> and venv would be a good choice. I've read through PEP405 and this
>> link [1].
>> Though some of it seems a little confusing to me, I'm sure I can get
>> it up and running. This question seems a little dumb and maybe I am
>> being a little dense, but then what?
>> Your program/script is done how do you run it? Do you always have to
>> activate your venv and run it from there? I like to run Tkinter
>> programs from a launcher. Would that be possible and what would the
>> command look like? Lately I have been writing some Libreoffice calc
>> macros and evaluating pyspread for it's macro capability. Would
>> modules installed in my venv be available to the spreadsheet programs?
> The mere act of using the python from inside the venv invokes a python
> that runs off the venv, so all you really need to do is to contrive to
> execute that python instead of the system python where you want it.
> If your scripts start with something like this:
>  #!/usr/bin/env python3
> then you can simply contrive that "python3" is found from the
> virtualenv. You might put a symlink in your personal $HOME/bin
> directory, or source the venv's "activate" file from your shell's
> profile (this making the venv searched ahead of the system paths), etc.
> Or your launcher might simply invoke:
>  $HOME/path/to/your/venv/bin/python your-tk-inter-script.py
> Cheers,
> Cameron Simpson <cs at zip.com.au>

Thank you. Got it up and running and tested it with a previously written 
Tkinter script, which works fine.

Regards,  Jim

More information about the Tutor mailing list