Werner Arnhold <wer...@arnhold-berlin.de> writes:

> The small shell script is:
>
>     #!/bin/bash
>   
>     PYTHONPATH=~/python3:~/python3/mathe
>     export PYTHONPATH
>
>     /usr/bin/python3 "$@"
>
> I use it because I need python2 and python3 in parallel  and want to
> have my own version-specific directories in the Path. At the start of
> the script PYTHONPATH is empty, when I start
>
>     import sys
>     print(sys.path)
>
> I get
>
>     
>     ['/home/werner', '/home/werner/python3', 
>     '/home/werner/python3/mathe', '/usr/lib/python37.zip', 
>     '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', 
>     '/usr/local/lib/python3.7/dist-packages', 
>     '/usr/lib/python3/dist-packages']
>
> Newline inserted by me. I don't preserve the former content of
> PYTHONPATH because the dirs for py2 and py3 would be mixed.

That does not hold water.  You write "At the start of the script
PYTHONPATH is unset" so there is nothing that would mix dirs for py2 and
py3.  PYTHONPATH will be empty unless some script sets it for the sake
of providing modules to a version of Python it is written for.

-- 
David Kastrup

Reply via email to