Gentoo Archives: gentoo-user

From: Ralph Seichter <m16+gentoo@×××××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] how to set python version for one user
Date: Tue, 10 Jul 2018 14:12:24
In Reply to: [gentoo-user] how to set python version for one user by
On 10.07.2018 10:23, pat@××××××××.org wrote:

> I need to set specific python version to a user and I don't want to > set it up for whole system. Is it possible?
I can't tell if by "set it up" to have Python binaries available for only one user, or if you want one user to use a different Python version from other users, with multiple Python versions potentially available to all users, which would be then "Gentoo way". If you have, for example, Python 2.7 and 3.6 installed, you can use "eselect python set ..." to configure the default Python for most users. For individual users, I recommend a Python virtual environment. You can use the 'virtualenv' module for both Python 2.7 and 3.x, but since Python 3.5 the built-in 'venv' module is recommended. I know soft links to a specific Python version were recommended here, but based on my experience I strongly discourage that. Your special user will need more than just the binaries, and a venv is definitely the more robust and versatile way to go. -Ralph