Am Mittwoch, 11. März 2020, 21:27:11 CET schrieb Grant Edwards:
> On 2020-03-11, Marc Joliet <mar...@gmx.de> wrote:
> > Am Mittwoch, 11. März 2020, 18:54:43 CET schrieb Grant Edwards:
> >> [...]
> >> Q: Under what conditions will having a second installation of a Python
> >> 
> >>    library under .local cause problems?
> > 
> > IIUC you shouldn't have any problems, simply because ~/.local/ is not part
> > of the system python's module search path:
> > 
> > % python3
> > Python 3.6.10 (default, Feb 26 2020, 01:09:02)
> > [GCC 9.2.0] on linux
> > Type "help", "copyright", "credits" or "license" for more information.
> > 
> >>>> import sys
> >>>> sys.path
> > 
> > ['', '/usr/lib64/python36.zip', '/usr/lib64/python3.6',
> > '/usr/lib64/python3.6/ lib-dynload',
> > '/usr/lib64/python3.6/site-packages']
> 
> Except it is for me (and I don't know how it gets there):
> 
>     $ which python
>     /usr/bin/python
> 
>     $ file /usr/bin/python
>     /usr/bin/python: symbolic link to python-exec2c
> 
>     $ file /usr/bin/python-exec2c
>     /usr/bin/python-exec2c: ELF 64-bit LSB pie executable, x86-64, version 1
> (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for
> GNU/Linux 3.2.0, stripped
> 
>     $ set | grep -i py
> 
>     $ python
>     Python 3.6.10 (default, Feb 26 2020, 16:43:12)
>     [GCC 9.2.0] on linux
>     Type "help", "copyright", "credits" or "license" for more information.
> 
>     >>> import sys
>     >>> sys.path
> 
>     ['', '/usr/lib64/python36.zip', '/usr/lib64/python3.6',
> '/usr/lib64/python3.6/lib-dynload',
> '/home/grante/.local/lib64/python3.6/site-packages',
> '/usr/lib64/python3.6/site-packages',
> '/usr/lib64/python3.6/site-packages/pygdbmi-0.8.4.0-py3.6.egg',
> '/usr/lib64/python3.6/site-packages/pcpp-1.1.1-py3.6.egg',
>     '/usr/lib64/python3.6/site-packages/pytz-2019.2-py3.6.egg',
>     '/usr/lib64/python3.6/site-packages/python_dateutil-2.8.0-py3.6.egg']
> 
> 
> The entry for /home/grante/.local/lib64/python3.6/site-packages (where
> pip --user installs things) is in my path.

You're right, I forgot that you would have used the system-wide pip and that 
it probably manipulates your sys.path appropriately (I don't know exactly how, 
though).  What I wrote only holds if you use virtualenvs (and for system 
packages that don't run as your user).  I suppose those are the most 
straightforward way to achieve what you want.  To that end you could check 
"python -m venv -h" in a terminal to get started, IIRC venv is the modern 
standard way of creating virtualenvs (I don't use it myself, as I require 
other binary packages that only conda provides).  You would then use the 
virtualenv's pip to install your software.

-- 
Marc Joliet
--
"People who think they know everything really annoy those of us who know we
don't" - Bjarne Stroustrup

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to