Another option is Nix, which with some effort can be installed in Ubuntu and can provide you with different environments for many languages. You can use it to create as many python installations as you want.


On 22/07/2021 20:05, Dan Yasny wrote:


On Thu, Jul 22, 2021 at 12:51 PM Shlomo Solomon <shlomo.solo...@gmail.com> wrote:
I guess I don't completely understand the concept after all. If I setup
a virtual environment for 3.9.6, how would it "know" that modules are
installed in the 3.8 directory? As I wrote in my original post, without
a virtual environment, in 3.9.6 I get:

>>> import scapy 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'scapy'

but the module does exist in 3.8:

sudo pip3 install scapy
Requirement already satisfied: scapy in
/usr/local/lib/python3.8/dist-packages (2.4.4)


So how do I tell the 3.9.6 environment to look for modules in the 3.8
directory?

You don't, that's the whole point of venv - you have a separate set of modules in each environment, specific to it's version. 

There's the site-packages argument of course, but it's far from being best-practice. 

 






On Thu, 22 Jul 2021 12:41:41 -0400
Dan Yasny <dya...@gmail.com> wrote:

> why reinstall? Keep your versions venvs in place and hop in/out
>
>
> On Thu, Jul 22, 2021 at 12:37 PM Shlomo Solomon
> <shlomo.solo...@gmail.com> wrote:
>
> > Omer Zak <w...@zak.co.il> wrote:
> > > The answer to your prayers is pyenv.
> > > It allows you to install multiple Python versions in parallel,
> > > and for each version you can maintain several virtualenvs.
> >
> > Dan Yasny <dya...@gmail.com> wrote:
> > > How about using virtualenv for alternative versions?
> >
> >
> > Yes, I know about pyenv and virtualenv, but wouldn't I have to
> > re-install modules for each version/environment? That's what I'm
> > trying to avoid.
> >
> >
> > --
> > Shlomo Solomon
> > http://the-solomons.net
> > Claws Mail 3.17.5 - KDE Plasma 5.18.5 - Kubuntu 20.04
> >



--
Shlomo Solomon
http://the-solomons.net
Claws Mail 3.17.5 - KDE Plasma 5.18.5 - Kubuntu 20.04

_______________________________________________
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


_______________________________________________
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il

Reply via email to