Python, Linux, default search places.

Karim kliateni at gmail.com
Fri Apr 8 07:37:26 EDT 2016



On 08/04/2016 12:01, Frantisek.Fridrich at rubena.cgs.cz wrote:
> Hello.
>
> Thank you to Karim, thank you to Wildman for response.
>
> I will describe my problem in more detail. Python on my computer is
> installed in /usr directory. My Python contains additional modules such as
> numpy, scipy, matplotlib, h5py, … . Python runs correctly.
>
> Third party program opens Python but I can’t import numpy and so on.
> Python can’t find numpy. After modifying PYTHONPATH, Python can find numpy
> but shows the following error message:
> /usr/lib64/python2.6/lib-dynload/math.so: undefined symbol: PyFPE_jbuf
> I think Python can’t find some libraries.
>
> I don’t know what the third party program does with environment variables
> but I think I should correctly define environment either in shell before I
> start third party program or in Python in third party program.
>
> That is the reason why I would like to know default:
>   - search path for libraries,
>   - search path for Python modules,
> in case LD_LIBRARARY_PATH and PYTHONPATH is empty not defined.
>
> I think that default
>   - search path for executables
> is easier task. I also would like to know the correct default definition.
>
> OS: SUSE Linux Enterprise Server 11.
> HW: HP DL160 Gen8 SFF CTO.
> Python 2.6.
>
> Frantisek
>
> Disclaimer: This email and any files transmitted with it are confidential
> and intended solely for the use of the individual or entity to whom they
> are addressed. Distribution only by express authority of a Rubena company.
>
Hi Frantisek,

If it could help you whatever the platform you are on the site python 
pkg gives you information of all 3rd parties modules and dynamic loads:

bash: python /usr/lib/python2.7/site.py

sys.path = [
     '/usr/lib/python2.7',
     '/home/karim/project/pyparsing-2.0.3',
     '/usr/lib/python2.7/plat-x86_64-linux-gnu',
     '/usr/lib/python2.7/lib-tk',
     '/usr/lib/python2.7/lib-old',
     '/usr/lib/python2.7/lib-dynload',
     '/usr/local/lib/python2.7/dist-packages',
     '/usr/lib/python2.7/dist-packages',
     '/usr/lib/python2.7/dist-packages/PILcompat',
     '/usr/lib/python2.7/dist-packages/gtk-2.0',
     '/usr/lib/pymodules/python2.7',
     '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
]
USER_BASE: '/home/karim/.local' (exists)
USER_SITE: '/home/karim/.local/lib/python2.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: True

Karim



More information about the Python-list mailing list