[gentoo-user] how to set python version for one user

2018-07-10 Thread pat

Hi,

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? If so how to do it. All I found 
is about setting for whole system.


Thanks

Pat


Freehosting PIPNI - http://www.pipni.cz/




Re: [gentoo-user] how to set python version for one user

2018-07-10 Thread Alexander Kapshuk
On Tue, Jul 10, 2018 at 11:23 AM  wrote:
>
> Hi,
>
> 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? If so how to do it. All I found
> is about setting for whole system.
>
> Thanks
>
> Pat
>
> 
> Freehosting PIPNI - http://www.pipni.cz/
>
>
How about this?
echo alias python='python2.7' >> ~user/.bash_profile



Re: [gentoo-user] how to set python version for one user

2018-07-10 Thread Helmut Jarausch

On 07/10/2018 10:23:05 AM, p...@xvalheru.org wrote:

Hi,

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? If so how to do it. All I  
found

is about setting for whole system.

Thanks

Pat



A simple method would be to set up the PATH for this user to prepend a  
local folder,

.e.g  $HOME/bin

Then copy (or symlink) the desired Python version from /usr/bin to that  
folder under

a different name (i.e. without the (full) version number)

Helmut




Re: [gentoo-user] how to set python version for one user

2018-07-10 Thread pat

On 2018-07-10 11:19, Alexander Kapshuk wrote:

On Tue, Jul 10, 2018 at 11:23 AM  wrote:


Hi,

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? If so how to do it. All I 
found

is about setting for whole system.

Thanks

Pat



How about this?
echo alias python='python2.7' >> ~user/.bash_profile



Well, this one doesn't work in case at the beginning of the python 
script is:

#!/usr/bin/env python

I have a "lot of scripts" with this. What I've thought there will be 
possibility to setup python version per user similar as for gcc (I 
think).


Thanks for help

Pat


Freehosting PIPNI - http://www.pipni.cz/




Re: [gentoo-user] how to set python version for one user

2018-07-10 Thread pat

On 2018-07-10 11:22, Helmut Jarausch wrote:

On 07/10/2018 10:23:05 AM, p...@xvalheru.org wrote:

Hi,

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? If so how to do it. All I
found
is about setting for whole system.

Thanks

Pat



A simple method would be to set up the PATH for this user to prepend a
local folder,
.e.g  $HOME/bin

Then copy (or symlink) the desired Python version from /usr/bin to that
folder under
a different name (i.e. without the (full) version number)

Helmut




Thanks I'll check this.

Pat


Freehosting PIPNI - http://www.pipni.cz/




Re: [gentoo-user] how to set python version for one user

2018-07-10 Thread Ralph Seichter
On 10.07.2018 10:23, p...@xvalheru.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




Re: [gentoo-user] how to set python version for one user

2018-07-10 Thread Mike Gilbert
On Tue, Jul 10, 2018 at 4:23 AM,   wrote:
> Hi,
>
> 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? If so how to do it. All I found is
> about setting for whole system.

On Gentoo, you can set the EPYTHON environment variable.

floppym@naomi ~ % python --version
Python 3.6.6
floppym@naomi ~ % export EPYTHON=python2.7
floppym@naomi ~ % python --version
Python 2.7.15



Re: [gentoo-user] how to set python version for one user [SOLVED]

2018-07-10 Thread pat

On 2018-07-10 14:09, p...@xvalheru.org wrote:

On 2018-07-10 11:22, Helmut Jarausch wrote:

On 07/10/2018 10:23:05 AM, p...@xvalheru.org wrote:

Hi,

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? If so how to do it. All I
found
is about setting for whole system.

Thanks

Pat



A simple method would be to set up the PATH for this user to prepend a
local folder,
.e.g  $HOME/bin

Then copy (or symlink) the desired Python version from /usr/bin to 
that

folder under
a different name (i.e. without the (full) version number)

Helmut




Thanks I'll check this.

Pat



Thanks Helmut, it works.

Pat


Freehosting PIPNI - http://www.pipni.cz/